note 79422 added to function.microtime
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 26 Nov 2007 20:57:50 +0000 |
| Subject: | note 79422 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132579@lists.php.net to get a copy of this message | ||
@zenofeller at zenofeller dot com:
I was trying to point out that randomString() significantly reduces the
"randomness-per-byte" compared to what mt_rand() and friends gives you to begin with - eg.
making it more "predictable".
If you're looking to generate hard-to-predict printable keys and cares about the length of the
key (you perhaps need to stick in in a CHAR(32) field of some db-table), you'd be better off
with either my rstr() or md5(uniqid(rand(), true)); which both will provide you with a much larger
keyspace (and thus a smaller chance of a collision) in the same amount of bytes as randomString().
I should have said "more predictable" instead of just "predictable" in my
previous post; you're indeed correct when you say that randomString() _will_ give you random
data. It most definitely does, it just doesn't do so very effectively :)
----
Server IP: 128.39.198.38
Probable Submitter: 193.91.135.250
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/79422
Del: integrated -- https://master.php.net/note/delete/79422/integrated
Del: useless -- https://master.php.net/note/delete/79422/useless
Del: bad code -- https://master.php.net/note/delete/79422/bad+code
Del: spam -- https://master.php.net/note/delete/79422/spam
Del: non-english -- https://master.php.net/note/delete/79422/non-english
Del: in docs -- https://master.php.net/note/delete/79422/in+docs
Del: other reasons-- https://master.php.net/note/delete/79422
Reject -- https://master.php.net/note/reject/79422
Search -- https://master.php.net/manage/user-notes.php