-
-
Notifications
You must be signed in to change notification settings - Fork 18
irandom_weighted
Vašek edited this page Feb 7, 2019
·
5 revisions
Randomly selects a position based on the given probability.
irandom_weighted(params int[] p)
Argument | Description |
---|---|
params int[] p |
Chances for the specific positions |
Returns: int
This function will randomly return a number of the position based on the given probability. Each number determines how often this position will be chosen. For example: irandom_weighted(1, 1)
This function has a 50% chance to return 0 and 50% to return 1.
int value = irandom_weighted(15, 15, 20);
This function has 30% chance to return 0, 30% to return 1 and 40% to return 2.
int value = irandom_weighted(1,999);
In this function there is only 0.1% chance to return 0 and 99,9 chance to return 1.
Back to number_functions