Class: RandomDraws
Constructors
new RandomDraws()
new RandomDraws():
RandomDraws
Returns
Methods
FromGridWithoutReplacement()
static
FromGridWithoutReplacement(n
,rows
,columns
,predicate
?):object
[]
Draw random grid cell locations, without replacement, from a uniform distribution of all grid cells. Grid cell locations are zero-based, i.e., upper-left is (0,0).
Parameters
• n: number
Number of draws
• rows: number
Number of rows in grid; must be at least 1
• columns: number
Number of columns in grid; must be at least 1
• predicate?
Optional lambda function that takes a grid row number and grid column number pair and returns a boolean to indicate if the pair should be allowed. For example, if one wanted to constrain the random grid location to be along the diagonal, the predicate would be: (row, column) => row === column
Returns
object
[]
Array of grid cells. Each cell is object in form of: { row: number, column: number }. Grid cell locations are zero-based
Defined in
RandomDraws.ts:66
FromRangeWithoutReplacement()
static
FromRangeWithoutReplacement(n
,minimumInclusive
,maximumInclusive
):number
[]
Draws random integers, without replacement, from a uniform distribution of integers in the specified range.
Parameters
• n: number
Number of draws
• minimumInclusive: number
Lower bound of range
• maximumInclusive: number
Upper bound of range
Returns
number
[]
An array of integers
Defined in
RandomDraws.ts:29
SingleFromRange()
static
SingleFromRange(minimumInclusive
,maximumInclusive
):number
Draws a single random integer from a uniform distribution of integers in the specified range.
Parameters
• minimumInclusive: number
Lower bound of range
• maximumInclusive: number
Upper bound of range
Returns
number
A sampled integer
Defined in
RandomDraws.ts:10