Prefix and random?
#1

Hey guys, I was wondering if its possible to use a prefix and a random function?

So for example (1337)&&random(1000000)+9999999

and lets say... the result would be: 13375215721.


Is it possible? If so how would you do it?
Reply
#2

And do you want fries with that?

Like, what do you want '13375215721' to be, exactly? Just the number? Or a string containing that?


EDIT: If it is just the number, you just add 13370000000 to whatever the output of random(0,99999999) is...

Do note, however, that I don't think Pawn can handle 64-bit numbers, and 13375215721 requires more than 32 bits...
Reply
#3

Quote:
Originally Posted by Deji
Посмотреть сообщение
And do you want fries with that?

Like, what do you want '13375215721' to be, exactly? Just the number? Or a string containing that?


EDIT: If it is just the number, you just add 13370000000 to whatever the output of random(0,99999999) is...

Do note, however, that I don't think Pawn can handle 64-bit numbers, and 13375215721 requires more than 32 bits...
Just a number. I am making a prefix system for ID's, Phone numbers, etc. But that was just random numbers its not going to be that long.
Reply
#4

Well a great lesson about the decimal system and, well, addition.. if you add 100 to 99, you get 199. A trick to working this out, is to imagine the numbers with a matching amount of digits (where any which weren't there are 0) like this:

1000 +
0999 =
1999

2500 +
0099 =
2599

Anywhere there's a 0, a digit can be added (assuming all digits before it are also 0) and it won't change the rest of the number. So I guess you could say it's "prefixed" - but it's simple addition, really
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)