about the possibilities with for loop(+Random function) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: about the possibilities with for loop(+Random function) (
/showthread.php?tid=535518)
about the possibilities with for loop(+Random function) -
DavidBilla - 04.09.2014
Are the following for loops valid?
pawn Код:
for(new i=1;i<10;i*=2)
for(new i=100;i>10;i/=2)
for(new i=25;i>1;i%=10)
Also another doubt is,if i assign a value random(5) to a variable n make it print the number when i execute a command. If i try the command 5 times in a row, will i get completely different numbers all the time (like 1 4 2 3 0) or will any number get repeated (like 4 0 2 4 1)?
Re: about the possibilities with for loop(+Random function) -
K9IsGodly - 04.09.2014
Quote:
Originally Posted by DavidBilla
Are the following for loops valid?
pawn Код:
for(new i=1;i<10;i*=2) for(new i=100;i>10;i/=2) for(new i=25;i>1;i%=10)
Also another doubt is,if i assign a value random(5) to a variable n make it print the number when i execute a command. If i try the command 5 times in a row, will i get completely different numbers all the time (like 1 4 2 3 0) or will any number get repeated (like 4 0 2 4 1)?
|
The numbers can be repeated with the random function, as it's entirely random. So there is always a chance you could have 4, 4, 4, 4, 4; but that's not likely at all.
Re: about the possibilities with for loop(+Random function) -
JM_Millers - 04.09.2014
Quote:
Are the following for loops valid?
pawn Код:
for(new i=1;i<10;i*=2) for(new i=100;i>10;i/=2) for(new i=25;i>1;i%=10)
|
Yes .