Random
import { Random } from "https://git.sr.ht/~ruivieira/deno-experiments/blob/master/randomjs/mod.ts";
A wrapper around an Engine that provides easy-to-use methods for producing values based on known distributions
§Constructors
§Properties
§Methods
Returns a boolean with 50% probability of being true or false
Returns a boolean with the provided percentage
of being true
A number within [0, 1] of how often the result should be true
Returns a boolean with a probability of numerator
/denominator
of being true
The numerator of the probability
The denominator of the probability
Returns a random Date
within the inclusive range of [start
, end
].
The minimum Date
The maximum Date
Returns an array of length dieCount
of values within [1, sideCount]
The number of sides of each die
The number of dice
Returns a value within [1, sideCount]
The number of sides of the die
Returns a random string comprised of numbers or the characters abcdef
(or ABCDEF
) of length length
.
Length of the result string
Whether the string should use ABCDEF
instead of abcdef
Returns a value within [min, max]
The minimum integer value, inclusive. No less than -0x20000000000000.
The maximum integer value, inclusive. No greater than 0x20000000000000.
Return a random value within the provided source
within the sliced
bounds of begin
and end
.
an array of items to pick from
the beginning slice index (defaults to 0
)
the ending slice index (defaults to source.length
)
Returns a floating-point value within [min, max) or [min, max]
The minimum floating-point value, inclusive.
The maximum floating-point value.
If true, max
will be inclusive.
From the population array, returns an array with sampleSize elements that are randomly chosen without repeats.
An array that has items to choose a sample from
The size of the result array
Returns a random string using numbers, uppercase and lowercase letters,
_
, and -
of length length
.
Length of the result string
Returns a random string using the provided string pool as the possible
characters to choose from of length length
.
Length of the result string
Returns a Universally Unique Identifier Version 4.
See http://en.wikipedia.org/wiki/Universally_unique_identifier