SA-MP Forums random number between two numbers
 New Account Members List Search Today's Posts Mark Forums Read

 24/01/2011, 10:54 PM #1 Davidovich Little Clucker   Join Date: Jan 2011 Posts: 17 Reputation: 0 random number between two numbers I've seen on wiki the random function but it only has the "max" parameter, so it would generate a number between 0 and "max-1". how can I generate a random number between two numbers? Like 5 and 10.... it would generate 5, 6, 7, 8, 9 or 10.
 24/01/2011, 10:56 PM #2 Fj0rtizFredde Gangsta     Join Date: Jun 2008 Location: Sweden Posts: 888 Reputation: 120 Re: random number between two numbers Like this? pawn Code: `stock randomEx(min, max){        //Credits to ******        new rand = random(max-min)+min;        return rand;}` __________________ Latest crap I've made: [Include]CleverBot - Never Be Alone Again!
24/01/2011, 10:59 PM   #3
Davidovich
Little Clucker

Join Date: Jan 2011
Posts: 17
Reputation: 0
Re: random number between two numbers

Quote:
 Originally Posted by Fj0rtizFredde Like this? pawn Code: `stock randomEx(min, max){        //Credits to ******        new rand = random(max-min)+min;        return rand;}`
hm
looks nice, lol, thanks
I would use like this?
Code:
`new A = randomEx(5,10);`
And, it would generate 5 and 10 or only 6, 7, 8 and 9?

 24/01/2011, 11:04 PM #4 Fj0rtizFredde Gangsta     Join Date: Jun 2008 Location: Sweden Posts: 888 Reputation: 120 Re: random number between two numbers Yes use it like that And Im not sure about if its 5-9 or 5-10 cant remember :/ Try it and you will find out __________________ Latest crap I've made: [Include]CleverBot - Never Be Alone Again!
 24/01/2011, 11:06 PM #5 Gabe Big Clucker     Join Date: Jan 2011 Posts: 55 Reputation: 0 Re: random number between two numbers It would generate 5-9
 24/01/2011, 11:09 PM #6 Davidovich Little Clucker   Join Date: Jan 2011 Posts: 17 Reputation: 0 Re: random number between two numbers ok thank you all

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post THE_KNOWN Help Archive 7 18/01/2011 01:14 PM psoftware Help Archive 7 31/12/2010 07:14 PM Rainbow_Six Help Archive 4 21/10/2010 07:08 PM SiJ Help Archive 6 09/08/2009 03:14 PM *BueNoOo* Help Archive 11 18/06/2009 05:13 PM

All times are GMT. The time now is 09:41 PM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top