IT Community - Software Programming, Web Development and Technical Support

How do I generate a random number from php?

This is a discussion on How do I generate a random number from php? within the PHP Programming forums, part of the Web Development category; Hi all...... Can anyone tell me, How do I generate a random number from php? Thanks & Regards, itbarota....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 09-11-2007, 11:26 PM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 542
itbarota is on a distinguished road
Default How do I generate a random number from php?

Hi all......

Can anyone tell me, How do I generate a random number from php?

Thanks & Regards,
itbarota.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 09-12-2007, 12:11 AM
sans sans is offline
D-Web Programmer
 
Join Date: Apr 2007
Posts: 69
sans is on a distinguished road
Default Re: How do I generate a random number from php?

Hi all.....

To generate a random number between 0 and 100 do this:

srand((double)microtime()*1000000);
echo rand(0,100);

Read more in the php manual:
PHP: rand - Manual
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 09-25-2007, 07:57 AM
Sabari Sabari is offline
D-Web Genius
 
Join Date: Jul 2007
Posts: 945
Sabari is on a distinguished road
Default Re: How do I generate a random number from php?

you can use this php function to generate random values,

md5(uniqid(0));
__________________
Thanks & Regards
Sabari...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
To get random number in mysql Murali Database Support 7 11-05-2007 10:34 PM
How to generate random password generator.using javascript.? itbarota HTML, CSS and Javascript Coding Techniques 1 07-25-2007 11:42 PM
How do I generate a random number from php? kingmaker PHP Programming 2 07-24-2007 01:56 AM
How to Generate Various types of random numbers using SQLServer ? Archer Database Support 1 07-16-2007 01:26 AM


All times are GMT -7. The time now is 10:49 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0