SA-MP Forums Archive
Possibilities - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Possibilities (/showthread.php?tid=87958)



Possibilities - SiJ - 23.07.2009

Hey,
Can I make possibilities using this:
pawn Код:
new number = random(100);

if(number == 1)
{
//do something
}
So there would be 1/100 possibility to execute //do something
Would that work?


Re: Possibilities - arnutisz - 23.07.2009

Maybe test yourself:
pawn Код:
new number = random(3);

if(number == 1)
{
print("1");
}
else if(number == 2)
{
print("2");
}
.....



Re: Possibilities - SiJ - 23.07.2009

Quote:
Originally Posted by Scott[LT
]
Maybe test yourself:
pawn Код:
new number = random(3);

if(number == 1)
{
print("1");
}
else if(number == 2)
{
print("2");
}
.....
Wouldn't it be easier to say just "Yes" or "No"
Thanks anyway.. I'll try...


Re: Possibilities - arnutisz - 23.07.2009

It wouldn't be easier, because I don't know correct answer, and I can't use pawno right now, I am using mobile.


Re: Possibilities - ғαιιοцт - 23.07.2009

yes it'll work.


Re: Possibilities - yezizhu - 23.07.2009

Код:
main{
 while(random(0)+1){
  printf("%d",random(10000000));
 }
}
It seems not very "random"


Re: Possibilities - ғαιιοцт - 23.07.2009

Quote:
Originally Posted by yezizhu
Код:
main{
 while(random(0)+1){
  printf("%d",random(10000000));
 }
}
It seems not very "random"
wtf where did you get this code? ><
it's pointless random(0)+1


Re: Possibilities - yezizhu - 23.07.2009

Quote:
Originally Posted by °ғαιιοцт°
Quote:
Originally Posted by yezizhu
Код:
main{
 while(random(0)+1){
  printf("%d",random(10000000));
 }
}
It seems not very "random"
wtf where did you get this code? ><
it's pointless random(0)+1
This will tell you how "unrandom" random() function is : p