[HELP] Random
#1

Hey, I have problem with random();

my script:
pawn Код:
new RandomLetter[][] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "O", "P", "Q", "R", "S", "T", "U", "V", "X", "Y", "Z" };
new rand = random(sizeof(RandomLetter));
format(Numbers, sizeof(Numbers), "%s%s%s %d%d%d",RandomLetter[rand] ,RandomLetter[rand] ,RandomLetter[rand] ,random(9), random(9), random(9));
The problem is, that it formats it as: ZZZ 468 or BBB 865, etc. Always the same letter.
How to fix it?
Reply
#2

Change
Код:
format(Numbers, sizeof(Numbers), "%s%s%s %d%d%d",RandomLetter[rand] ,RandomLetter[rand] ,RandomLetter[rand] ,random(9), random(9), random(9));
to
Код:
format(Numbers, sizeof(Numbers), "%s%s%s %d%d%d",RandomLetter[random(sizeof(RandomLetter))] ,RandomLetter[random(sizeof(RandomLetter))] ,RandomLetter[random(sizeof(RandomLetter))] ,random(9), random(9), random(9));
and remove
Код:
new rand = random(sizeof(RandomLetter));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)