SA-MP Forums [HELP] Random Numbers
 New Account Members List Search Today's Posts Mark Forums Read

 31/12/2010, 05:26 PM #1 psoftware Little Clucker     Join Date: Oct 2010 Location: Italy, Potenza, Basilicata Posts: 32 Reputation: 0 [HELP] Random Numbers Hello!! In my gamemode i found many problems with random numbers. I want to do a random number min than 99999999999 and major than 00000000000. Can you tell me the solution?? N.B. The number must be eleven digits and sorry for my english, i'm italian.
31/12/2010, 05:35 PM   #2
<Weponz>
Huge Clucker

Join Date: Jul 2010
Location: Program Files/Scripts/Weponz/Pawno
Posts: 459
Reputation: 1
Re: [HELP] Random Numbers

#define MAX_RAND_NUM 99999999999

??
__________________
Quote:
 Originally Posted by __ 1) I'm not fat 2) I'm smart 3) I have a normal life 4) Again, I have a normal life and I'm smart
Quote:
 Originally Posted by Geso I like talking to people like this, makes me feel smart xD

 31/12/2010, 05:52 PM #3 psoftware Little Clucker     Join Date: Oct 2010 Location: Italy, Potenza, Basilicata Posts: 32 Reputation: 0 Re: [HELP] Random Numbers You didn't understand me. I want to do a string like this x.x.x.x.x.x.x.x.x.x.x where x are random numbers from 0 to 9
31/12/2010, 05:58 PM   #4
DeathOnaStick
High-roller

Join Date: May 2009
Location: 127.0.0.1
Posts: 1,028
Reputation: 27
Re: [HELP] Random Numbers

Quote:
 Originally Posted by psoftware You didn't understand me. I want to do a string like this x.x.x.x.x.x.x.x.x.x.x where x are random numbers from 0 to 9
pawn Code:
`new string[20];format(string, sizeof(string), "%i.%i.%i.%i.%i.%i.%i.%i.%i", random(10), random(10), random(10), random(10), random(10), random(10), random(10), random(10), random(10), random(10));print(string);`

Try it. You want it like this?

31/12/2010, 06:00 PM   #5
<Weponz>
Huge Clucker

Join Date: Jul 2010
Location: Program Files/Scripts/Weponz/Pawno
Posts: 459
Reputation: 1
Re: [HELP] Random Numbers

Use this function..

pawn Code:
`Random(100000000000);`

Will return a value from 0-99999999999
__________________
Quote:
 Originally Posted by __ 1) I'm not fat 2) I'm smart 3) I have a normal life 4) Again, I have a normal life and I'm smart
Quote:
 Originally Posted by Geso I like talking to people like this, makes me feel smart xD

 31/12/2010, 06:05 PM #6 Joe Staff High-roller   Join Date: Aug 2007 Posts: 2,593 Reputation: 379 Re: [HELP] Random Numbers You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).
 31/12/2010, 06:10 PM #7 psoftware Little Clucker     Join Date: Oct 2010 Location: Italy, Potenza, Basilicata Posts: 32 Reputation: 0 Re: [HELP] Random Numbers Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini
31/12/2010, 06:14 PM   #8
DeathOnaStick
High-roller

Join Date: May 2009
Location: 127.0.0.1
Posts: 1,028
Reputation: 27
Re: [HELP] Random Numbers

Quote:
 Originally Posted by psoftware Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini
pawn Code:
`dini_Set(filename, "Name", string);`

In this case "Name" is the name, the string is assigned to.

Quote:
 Originally Posted by SilentHuntR You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).
I did.

 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 Rainbow_Six Help Archive 4 21/10/2010 06:08 PM Kyle Help Archive 2 09/08/2010 02:11 PM Torran Help Archive 1 02/04/2010 07:51 PM SiJ Help Archive 6 09/08/2009 02:14 PM *BueNoOo* Help Archive 11 18/06/2009 04:13 PM

All times are GMT. The time now is 04:28 AM.

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