note 26860 deleted from function.rand by aidan

From: Date: Sat, 10 Jul 2004 02:34:04 +0000
Subject: note 26860 deleted from function.rand by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72963@lists.php.net to get a copy of this message
Note Submitter: ---- This seems quite randomized to me, and useful. // //Function - Psuedo-Random ASCII generator for hashing etc // srand((double)microtime()*1234567); function rand_ascii($num) { for ($i=0;$i<$num;$i++) { $randnum .= "&#" . rand(33,255) . ";"; } return $randnum; } -------------------------- I tested this 200 times over and over, throwing them into arrays and comparing each array to 199 others. I did this several times and came up with no matches. Expect to see this type of look to your printed results: …yÍ»¥éØsL€/;7õ5µ³ô!S¼uw” ãh)¹ÓՁUziF*ç½P½ýa)dì𩃠­ëzXU'ÅUŽˆÎ±rÖVÛlGl®s=Ñx Ïwk3è¸Ó“3][Ã0’LÙ/VžzÒÔڙ -- it isn't the most widly randomized thing, but trimming rand(33,255) to rand(48,57) gives you anything from 0 - 9, trimming to rand(65,90) gives you anything from A - Z, and rand(97,122) anything from a - z. (Note, the middle of 'Z' and 'a' are the following characters, in order: [\]^_` Enjoy

« previous php.notes (#72963) next »