Tommy D’s Sexy Blog

TagLine Here

PHP Tip, using the rand() function

Filed under: PHP Tips — Tommy D. at 2:03 pm on Wednesday, July 6, 2005

Before using the rand() function, it’s a good idea to seed the random number generator first. This can be done with the srand() function. Its most common form is:

srand((double)microtime() * 1000000);

If you don’t take this step before using rand(), it’s possible – likely, even – that your “random” numbers will not necessarily be random.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

 

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin