Random
9 nodes
On this page 9
Pick at Random
FunctionOne item of a list, picked at random, every item equally likely.
From(items: IList<TType>) -> TType
TType From(IList<TType> items)
Parameters
| name | type | default | description |
|---|---|---|---|
| items | IList<TType> | — | The items to pick from: a list or an array of anything. |
Returns
| Item | TType |
Remarks
Each run picks differently. To pick the same way every run, use Pick From Generator with a Seeded Generator.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Pick From Generator
FunctionOne item of a list, picked with the given generator, every item equally likely; with a Seeded Generator the same picks come out every run.
From(items: IList<TType>, random: Random) -> TType
TType From(IList<TType> items, Random random)
Parameters
| name | type | default | description |
|---|---|---|---|
| items | IList<TType> | — | The items to pick from: a list or an array of anything. |
| random | Random | — | The generator to draw from, made by Seeded Generator. |
Returns
| Item | TType |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Pick at Random by Weight
FunctionOne item of a list, picked at random, each item's chance in proportion to its weight: an item weighted 2 comes up twice as often as one weighted 1, and one weighted 0 never does.
FromByWeight -> TType
items: IList<TType>
weights: IList<Number>TType FromByWeight(IList<TType> items, IList<double> weights)
Parameters
| name | type | default | description |
|---|---|---|---|
| items | IList<TType> | — | The items to pick from. |
| weights | IList<Number> | — | One weight for each item, in the same order, each zero or more. |
Returns
| Item | TType |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Pick by Weight From Generator
FunctionOne item of a list, picked with the given generator, each item's chance in proportion to its weight; with a Seeded Generator the same picks come out every run.
FromByWeight -> TType
items: IList<TType>
weights: IList<Number>
random: RandomTType FromByWeight(
IList<TType> items,
IList<double> weights,
Random random)Parameters
| name | type | default | description |
|---|---|---|---|
| items | IList<TType> | — | The items to pick from. |
| weights | IList<Number> | — | One weight for each item, in the same order, each zero or more. |
| random | Random | — | The generator to draw from, made by Seeded Generator. |
Returns
| Item | TType |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Seeded Generator
FunctionA random number generator that gives the same sequence every time it is given the same seed: for picks and numbers that come out the same every run, such as a procedural level or a test.
FromSeed(seed: Integer) -> Random
Random FromSeed(int seed = 42)
Parameters
| name | type | default | description |
|---|---|---|---|
| seed | Integer | 42 | Any whole number; the same seed gives the same sequence. |
Returns
| Generator | Random |
Remarks
Give it to the nodes that take a generator. The sequence for a seed holds within one .NET version but is not promised across major versions.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Random Number
FunctionA random number from Min Value up to, but not including, Max Value, every value in between equally likely.
Range(minValue: Number, maxValue: Number) -> Number
double Range(double minValue = 0, double maxValue = 1)
Parameters
| name | type | default | description |
|---|---|---|---|
| minValue | Number | 0 | The lower end, which can come up. |
| maxValue | Number | 1 | The upper end, which does not; below the lower end, the number lies between the two the other way round. |
Returns
| Number | Number |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Number From Generator
FunctionA random number from Min Value up to, but not including, Max Value, drawn from the given generator; with a Seeded Generator the same numbers come out every run.
Range -> Number
minValue: Number
maxValue: Number
random: Randomdouble Range(double minValue, double maxValue, Random random)
Parameters
| name | type | default | description |
|---|---|---|---|
| minValue | Number | — | The lower end, which can come up. |
| maxValue | Number | — | The upper end, which does not. |
| random | Random | — | The generator to draw from, made by Seeded Generator. |
Returns
| Number | Number |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Random Whole Number
FunctionA random whole number from Min up to, but not including, Max: for a dice roll, 1 and 7.
Range(min: Integer, max: Integer) -> Integer
int Range(int min = 1, int max = 7)
Parameters
| name | type | default | description |
|---|---|---|---|
| min | Integer | 1 | The smallest number that can come up. |
| max | Integer | 7 | One more than the largest number that can come up; equal to the smallest, it is always the smallest. |
Returns
| Number | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library
Whole Number From Generator
FunctionA random whole number from Min up to, but not including, Max, drawn from the given generator; with a Seeded Generator the same numbers come out every run.
Range(min: Integer, max: Integer, random: Random) -> Integer
int Range(int min, int max, Random random)
Parameters
| name | type | default | description |
|---|---|---|---|
| min | Integer | — | The smallest number that can come up. |
| max | Integer | — | One more than the largest number that can come up. |
| random | Random | — | The generator to draw from, made by Seeded Generator. |
Returns
| Number | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Random
- Package
- Standard Library