ironman32 Posted April 20, 2009 Share Posted April 20, 2009 I'm using this piece of code as part of an array but I just needed to know what it is or its purpose. srand((float) microtime() * 10000000); I've read about it at php.net but I still don't fully understand. Would someone be able to break it down please? Link to comment https://forums.phpfreaks.com/topic/154955-solved-random-function/ Share on other sites More sharing options...
taith Posted April 20, 2009 Share Posted April 20, 2009 srand() is a function that seeds the rand() function's generator... giving it a more... randomeyness().... tho as of php 4.2.0, this function is depreciated(not necessary) seeing as rand() does it on its own naturally now as far as that code... basically... its taking the microtime(a timestamp, with miliseconds), and multiplying it by 10 million, and using that as a seed... seeing as every time the page loads, the microtime changes, it'll consistantly be giving the srand() a new number to seed (more randomeyness) Link to comment https://forums.phpfreaks.com/topic/154955-solved-random-function/#findComment-815077 Share on other sites More sharing options...
ironman32 Posted April 21, 2009 Author Share Posted April 21, 2009 Thanks a lot, that was clear. Link to comment https://forums.phpfreaks.com/topic/154955-solved-random-function/#findComment-815126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.