...

View Full Version : Random numbers



exzrael
03-25-2007, 12:24 AM
I have been looking for a script which randomly picks three numbers within a certain range and shows them at a given date & time.

Until that, the site should show three numbers every five or ten seconds by automatic. All visitors should get the same numbers and should not change even
when refreshing the site.

* All visitors see the same numbers
* New numbers are generated every five or ten seconds and are shown
* Final and staying numbers are generated at a given time and date

Could this be done? Any help would be most appreciated.

iLLin
03-25-2007, 12:40 AM
Yea if I follow you correctly? You want 3 numbers to show for 10 seconds? Then show 3 different ones the next 10 seconds? Then at a specific time you want a predetermine set of 3 numbers shown.

For instance:

5:10:15 pm numbers ( 3, 15, 9)
5:10:20 pm numbers ( 3, 15, 9)

5:10:25 pm new numbers ( 12, 44, 2)

Then at 6:00:00 I want to show the numbers ( 5, 20, 25)

Is this what your talking about?

exzrael
03-25-2007, 08:46 AM
Yes, that is what im after.

iLLin
03-25-2007, 04:41 PM
I don't think there is a way to generate random numbers on the spot for ALL users. You could generate your 3 random numbers with a cron job everyday for all day then put them in a database and call it that way? Would be the same thing just woudn't randomize on the spot.



$time = date("H:i:s");
$my_time = "06:00:00";

if($time == $my_time) {
//winner
} else {
//query for numbers in db by time frame
}


Or I guess you could generate one row in the db with the current numbers and just bump the time against that everytime the the page is loaded. So it will know when to generate new numbers. This would probably be a better way then running a cron job, no need for that. :P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum