Generate the requested count of bytes.
This method consumes 32-bit random values and emits them as bytes.
number of bytes to generate
filled Uint8Array
Release resources owned by the generator.
JavaScript generators do not own external resources, so their default implementation is a no-op. Resource-backed subclasses override it.
Generate an exponentially distributed random value.
positive rate parameter
exponentially distributed random value
Fill a typed random array with values.
Uint32Array: raw 32-bit valuesFloat32Array: values in [0, 1)Float64Array: values formed from pairs of 32-bit wordsarray to fill
the filled array
Create a Float32Array containing the requested count of random
values in [0, 1).
number of elements to generate
filled Float32Array
Create a Float64Array containing the requested count of random
values in [0, 1).
number of values to generate
filled Float64Array
Generate an unbiased integer in the range [0, max_exclusive).
Rejects high values that would bias the result when the range does not evenly divide the 32-bit space.
exclusive upper bound for the generated integer
random integer in [0, max_exclusive)
Generate the next floating-point random value in [0, 1).
This method is the default random value generator and delegates to
next_f64() for full double-precision output.
Generate a 64-bit-quality floating-point random value in [0, 1).
Combines two 32-bit random values to produce a 53-bit mantissa for a standard JavaScript double precision result.
Generate the next 32-bit unsigned integer.
Generate a normally distributed random value.
The result uses the Box-Muller transform with the specified mean and standard deviation.
distribution mean
distribution standard deviation
normally distributed random value
Create a Uint32Array containing the requested count of raw
32-bit random values.
number of elements to generate
filled Uint32Array
Shared base implementation for random generators.
Concrete generators must implement
next_u32()and can reuse the helper methods here for generating floats, arrays, bytes, and statistical samples.