19.11.2013, 13:57
Quote:
|
I found out random when called after it self tends to generate a number just 1 off from it self. I made a little reaction test script, and when I generate a random number to pull a char out of a string, it tends to pick the letter afterwards.
Код:
new ReactionChars[] = "aAbBcCdDeEfFgGhHIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789"; It tends to do this quite often so I added a check to see if the number generated is within a +-1 error margin to prevent it. I also considered doing a random(1/2 size of str) + random(1/2 size of str) |
I ran this:
pawn Код:
#include <a_samp>
main() {
SetTimer("Test", 250, true);
}
forward Test();
public Test()
{
new ReactionChars[] = "aAbBcCdDeEfFgGhHIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789";
new string[10];
for (new i = 0; i < sizeof(string)-1; i++)
{
string[i] = ReactionChars[random(sizeof(ReactionChars)-1)];
}
print(string);
}
and got this list:
pawn Код:
I1Be637Ba
qRpw3xZS1
Tubt1mtVN
Xfl8hk1xh
1tcL0Pvxv
WEb15SMyM
SCCZ49PT8
HUOSHYcuw
LQMKPmLdz
8emNShHUw
Jtbtmt5WK
mYXjDDe2G
Ua2hkREhC
jdoOXFHGr
ZMfe3aR0t
bIC1yJEhw
VUbTHkzRh
jbZoQafeu
oz4K5MTda


