Computer Forums

Go Back   Computer Forums > Internet > Website Development

Website Development HTML, traffic, hosting, and more... this is the forum for every webmaster.

Register Now for FREE!
Computer Forums

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Agree to forum rules 


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-16-2007, 03:46 AM
SeanFlaherty's Avatar
Prepare to be moderated
 
Join Date: 02 Jan 2007
Location: TX
Posts: 322
SeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond repute
Default Random Number Generator

In PHP, I'm going to make a random number generator, but I don't exactly know how... And can someone show me a code that does random numbers?

~Sean
__________________
http://www.compuforums.org/image.php?type=sigpic&userid=884&dateline=12149234  87
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-16-2007, 06:30 AM
Captain Kirk's Avatar
New Member
 
Join Date: 14 Jan 2007
Posts: 28
Captain Kirk is on a distinguished road
Default

Hi.

Try this.

PHP Code:
<?
srand
(time());
$random = (rand()%9);
print(
"random number between 0 and 9 is: $random");
?>
If you want to know what it looks like in a browser, i have uploaded a test for it here refresh the page, and the number should change. (If it doesn't refresh again)
Hope this helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-16-2007, 07:41 AM
Ash's Avatar
Ash Ash is online now
CF owner
 
Join Date: 27 Jul 2005
Location: Devon, UK
Posts: 4,138
Ash has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond repute
Default

Of course, a computer only generates pseudo-random numbers since it's processor is completley logical. So if you're after really random numbers take a look at Random.org - True Random Number Service. But PHP's "random" numbers should be fine for most situations.
__________________
Thanks,
Ash
CF Founder

Great Webhosting. Shared starting at $2 per month. VPSes starting at $6 per month.
www.Centicero.com

Want to get in touch? Send me a PM | Do you want to continue receiving free help? Or do you want this site to close? Become a premium member.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-16-2007, 06:40 PM
SeanFlaherty's Avatar
Prepare to be moderated
 
Join Date: 02 Jan 2007
Location: TX
Posts: 322
SeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond reputeSeanFlaherty has a reputation beyond repute
Default

Okay, thanks both of you. I'll try both of these

~Sean
__________________
http://www.compuforums.org/image.php?type=sigpic&userid=884&dateline=12149234  87
Digg this Post!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

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


All times are GMT. The time now is 06:54 PM.



Powered by: vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Content © Copyright 2005-2008 CompuForums. All Rights Reserved. Some content © Copyright of the respective owners.
Cheap Gas - Loans - Mortgage - Arizona Pools

Content Relevant URLs by vBSEO 3.2.0 RC5