This function is used as the Crates plugin's random number generator, the following code is used for this plugin:
int Rnd = Commands->Get_Random_Int(1,101);
I get the following output with this code (output in spoilers):
for (int i = 0; i < 100; i++)
{
int Rnd = Commands->Get_Random_Int(1,101);
Console_Output("Rnd = %d\n", Rnd);
}
The resulting output is:
Toggle SpoilerRnd = 75
Rnd = 25
Rnd = 69
Rnd = 23
Rnd = 64
Rnd = 78
Rnd = 59
Rnd = 17
Rnd = 10
Rnd = 21
Rnd = 31
Rnd = 15
Rnd = 46
Rnd = 69
Rnd = 82
Rnd = 31
Rnd = 83
Rnd = 87
Rnd = 15
Rnd = 67
Rnd = 41
Rnd = 10
Rnd = 42
Rnd = 11
Rnd = 83
Rnd = 39
Rnd = 28
Rnd = 27
Rnd = 73
Rnd = 99
Rnd = 7
Rnd = 78
Rnd = 48
Rnd = 11
Rnd = 37
Rnd = 63
Rnd = 4
Rnd = 69
Rnd = 42
Rnd = 81
Rnd = 26
Rnd = 69
Rnd = 48
Rnd = 37
Rnd = 11
Rnd = 9
Rnd = 18
Rnd = 85
Rnd = 36
Rnd = 56
Rnd = 64
Rnd = 60
Rnd = 87
Rnd = 44
Rnd = 85
Rnd = 83
Rnd = 63
Rnd = 5
Rnd = 76
Rnd = 61
Rnd = 94
Rnd = 61
Rnd = 42
Rnd = 54
Rnd = 32
Rnd = 35
Rnd = 34
Rnd = 57
Rnd = 14
Rnd = 95
Rnd = 43
Rnd = 51
Rnd = 2
Rnd = 74
Rnd = 80
Rnd = 30
Rnd = 24
Rnd = 23
Rnd = 70
Rnd = 79
Rnd = 56
Rnd = 97
Rnd = 15
Rnd = 46
Rnd = 78
Rnd = 96
Rnd = 25
Rnd = 29
Rnd = 63
Rnd = 15
Rnd = 1
Rnd = 53
Rnd = 89
Rnd = 47
Rnd = 38
Rnd = 35
Rnd = 51
Rnd = 38
Rnd = 95
Rnd = 57
The pattern is very simple, if a number is returned a few calls later a number in a range of less than 10 higher or lower will be returned (seems to average at a range of ~5 higher/lower) around 85-90% of the time.
I reported this issue to Black-Cell in 2005 if I remember correctly and one of the programmers there acknowledged Renegade's random number generator isn't that great.
The result is what you see on SSGM servers with custom crates enabled, you won't see Spy crates for an hour but after someone picks up one in close succession there will be 1-3 other Spy crates. Same with all the other crates but it's the most noticeable with this one as it has such a low probability of showing up.
The random number generator code might be time based, I haven't checked that and I doubt it as I can't see calls to time based code for any of the random number generator classes (quickly scanning over it) and I see them using rand() for stuff like team remix/rebalance.
[Updated on: Sun, 12 August 2012 13:10]
Report message to a moderator