[HELP] Random Numbers
#1

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.
Reply
#2

#define MAX_RAND_NUM 99999999999

??
Reply
#3

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
Reply
#4

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 Код:
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?
Reply
#5

Use this function..

pawn Код:
Random(100000000000);
Will return a value from 0-99999999999
Reply
#6

You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).
Reply
#7

Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini
Reply
#8

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 Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)