Random.GetValues
namespace Foo open System [<AutoOpen>] module FsExtensions = type Random with /// Generates an infinite sequence of random numbers within the given range. member this.GetValues(minValue, maxValue) = Seq.initInfinite (fun _ -> this.Next(minValue, maxValue))Example:
let rnd = Random() for x in rnd.GetValues(1, 100) do printfn "%d" x
Description
Generates an infinite sequence of random numbers that fall within a given range.
Details
- Author: Joel Mueller
- Submitted on: 10/29/2010 7:28:44 PM
- Language: F#
- Type: System.Random
- Views: 2101
Double click on the code to select all.