deviss Posted March 1, 2011 Share Posted March 1, 2011 Hello I've got a php script that generates random number every page refresh <?php srand ((double) microtime( )*1000000); $random_number = rand(1000,5000); echo "$random_number"; ?> I would like some advanced things... first of all i don't want the random number to be generated every page refresh I would like something like... based on pc hour example: - between 12 AM and 5 AM it will generate a number from 500 to 1000 randomly but the number should change also to a determined time i set such as every 5 minutes and not everytime i refresh the website page - betweem 5 AM - 2 PM will generate a number from 3500 to 8000 and this number will change every 5 minutes too with one that exists between this interval - and so on Would appreciate if someone could help me with that Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/229203-help-got-a-random-number-generator-would-like-some-advanced-tweaks/ Share on other sites More sharing options...
deviss Posted March 2, 2011 Author Share Posted March 2, 2011 anyone can help ? Quote Link to comment https://forums.phpfreaks.com/topic/229203-help-got-a-random-number-generator-would-like-some-advanced-tweaks/#findComment-1182096 Share on other sites More sharing options...
deviss Posted March 28, 2011 Author Share Posted March 28, 2011 Anyone can answer in this thread? Quote Link to comment https://forums.phpfreaks.com/topic/229203-help-got-a-random-number-generator-would-like-some-advanced-tweaks/#findComment-1193076 Share on other sites More sharing options...
Cory94bailly Posted March 28, 2011 Share Posted March 28, 2011 First you would have to check the time. Then you would need either a cookie or something in a database to determine the time since it was last generated. Quote Link to comment https://forums.phpfreaks.com/topic/229203-help-got-a-random-number-generator-would-like-some-advanced-tweaks/#findComment-1193082 Share on other sites More sharing options...
deviss Posted March 29, 2011 Author Share Posted March 29, 2011 the problem is ...how i do that Quote Link to comment https://forums.phpfreaks.com/topic/229203-help-got-a-random-number-generator-would-like-some-advanced-tweaks/#findComment-1193765 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.