utils# Randomizer

new Randomizer(_seedopt)

Mersenne Twister random number generator.

Parameters:
NameTypeAttributesDefaultDescription
_seedNumber<optional>
new Date().getTime()

The seed for the random number generator. If _seed == null then the actual time gets used as seed.

Members

random

Returns a float between 0 and 1.

random_int

Returns an integer between 0 and MAX_INTEGER.

seed

Returns the seed of the random number generator.

Methods

(static) choice(A, n, seed) → {Array}

Parameters:
NameTypeDefaultDescription
AMatrix | Array | Float64Array

The input Matrix or Array.

nNumber

The number of samples.

seedNumber1212

The seed for the random number generator.

Returns:
  • A random selection form A of n samples.
Type: 
Array

choice(A, n) → {Array}

Returns samples from an input Matrix or Array.

Parameters:
NameTypeDescription
AMatrix | Array | Float64Array

The input Matrix or Array.

nNumber

The number of samples.

Returns:
  • A random selection form A of n samples.
Type: 
Array