FsRandom


Array

Provides basic operations on arrays.

Functions and values

Function or valueDescription
randomCreate(count generator)
Signature: count:int -> generator:GeneratorFunction<'a> -> GeneratorFunction<'a []>
Type parameters: 'a

Creates an array whose elements are randomly generated.

randomFill(...)
Signature: array:'a [] -> targetIndex:int -> count:int -> generator:GeneratorFunction<'a> -> GeneratorFunction<unit>
Type parameters: 'a

Fills an array whose elements are randomly generated.

randomInit(count initializer)
Signature: count:int -> initializer:(int -> GeneratorFunction<'a>) -> GeneratorFunction<'a []>
Type parameters: 'a

Creates an array whose elements are randomly generated.

sample(n source)
Signature: n:int -> source:'a [] -> GeneratorFunction<'a []>
Type parameters: 'a

Picks up random samples without replacement in the specified array.

sampleOne(source)
Signature: source:'a [] -> GeneratorFunction<'a>
Type parameters: 'a

Picks up a random sample in the specified array.

sampleWithReplacement(n source)
Signature: n:int -> source:'a [] -> GeneratorFunction<'a []>
Type parameters: 'a

Picks up random samples with replacement in the specified array.

shuffle(array)
Signature: array:'a [] -> GeneratorFunction<'a []>
Type parameters: 'a

Creates a new array whose elements are random set of the elements of the specified array.

shuffleInPlace(array)
Signature: array:'a [] -> GeneratorFunction<unit>
Type parameters: 'a

Shuffles the elements of the specified array by mutating it in-place.

weightedSample(n weight source)
Signature: n:int -> weight:float [] -> source:'a [] -> GeneratorFunction<'a []>
Type parameters: 'a

Picks up weighted random samples without replacement in the specified array.

weightedSampleOne(weight source)
Signature: weight:float [] -> source:'a [] -> GeneratorFunction<'a>
Type parameters: 'a

Picks up a random sample in the specified array.

weightedSampleWithReplacement(...)
Signature: n:int -> weight:float [] -> source:'a [] -> GeneratorFunction<'a []>
Type parameters: 'a

Picks up weighted random samples with replacement in the specified array.

Fork me on GitHub