forget how to create random variable - 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: forget how to create random variable (
/showthread.php?tid=306815)
forget how to create random variable -
leingod - 28.12.2011
I forgot how to create random variable
its look like this?
Код:
new randomz = random(100 - 10);
The code i want is random from 10 to 100
Re: forget how to create random variable -
spedico - 28.12.2011
#define RandomEx(%0,%1) (random((%1) - (%0)) + (%0))'
RandomEx(10, 100);
Re: forget how to create random variable -
leingod - 28.12.2011
Explain pls
Re: forget how to create random variable -
Tee - 28.12.2011
Wrong topic.
Re: forget how to create random variable -
leingod - 28.12.2011
Quote:
Originally Posted by Tee
Wrong topic.
|
pardon me
then where i can post this?
Re: forget how to create random variable -
TheArcher - 28.12.2011
Quote:
Originally Posted by Tee
Wrong topic.
|
It is the right topic.
OnTopic.
spedico used marcros to do a variable fast, easy and usefull.
pawn Код:
#define RandomEx(%0,%1) floatround(random((%1) - (%0)) + (%0))
That's more accurate.щ
Example:
pawn Код:
#define RandomEx(%0,%1) floatround(random((%1) - (%0)) + (%0))
new result = RandomEx(10,100);
printf(" result is %d ", result);
Re: forget how to create random variable -
Tee - 28.12.2011
Quote:
Originally Posted by leingod
pardon me
then where i can post this?
|
Quote:
Originally Posted by TheArcher
It is the right topic.
OnTopic.
spedico used marcros to do a variable fast, easy and usefull.
pawn Код:
#define RandomEx(%0,%1) floatround(random((%1) - (%0)) + (%0))
That's more accurate.щ
Example:
pawn Код:
#define RandomEx(%0,%1) floatround(random((%1) - (%0)) + (%0)) new result = RandomEx(10,100); printf(" result is %d ", result);
|
I didn't say wrong board, I said wrong topic. I meant I posted a reply in the wrong topic...
Re: forget how to create random variable -
Deathlane - 28.12.2011
I prefer you to watch this:
[ame]http://www.youtube.com/watch?v=jS7u6r94IFw[/ame]
I learned it there...
Re: forget how to create random variable -
TheArcher - 28.12.2011
@ObelesMarc
It's more faster using macros than stocks. That makes it more faster.
But stocks can return instead.
Re: forget how to create random variable -
Deathlane - 14.01.2012
Removed