Zesstra | b6ac9f6 | 2020-01-21 11:11:16 +0100 | [diff] [blame] | 1 | SYNOPSIS |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 2 | int random(int n) |
| 3 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 4 | DESCRIPTION |
| 5 | Returns a number in the random range [0 .. n-1]. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 6 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 7 | The random number generator is proven to deliver an equal distribution |
| 8 | of numbers over a big range, with no repetition of number sequences |
| 9 | for a long time. The downside of these (desirable) qualities is that |
| 10 | when generating numbers in a small range over short time, certain |
| 11 | numbers will appear far more often than others. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 13 | The only solution is the implementation of a special simul_efun which |
| 14 | takes special steps to implement an equal distribution over small |
| 15 | ranges and short times. |