Jump to content

Random Numbers


Xurion

Recommended Posts

Hi all,

I haven't played around with random numbers in PHP much before and I am trying to create a random number that has 12 digits (an order number for a client)

At the moment i have something like this:

[code]$mynum = ceil(rand(100000000000, 999999999999);[/code]

Thinking that this should generate a number from 100000000000 - 999999999999 it doesn't. It sometimes comes up with negative numbers like -5786142...?

Am I using this code in an incorrect way?

Thanks in advance.
Link to comment
https://forums.phpfreaks.com/topic/24074-random-numbers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.