SV: Random

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

First take a look at the notes to rand() in the manual, there are
several examples on how to generate random strings. To awoid
duplications you could just put the used ones in an array and check
every new one with in_array().
Alternativly, if you dont want to use arrays you could write a non
repeating hash function and use microtime as the call value.

Hth Henrik Hornemann 

-----Oprindelig meddelelse-----
Fra: SargeTron [mailto:sargetron@xxxxxxxxxx] 
Sendt: 19. januar 2005 18:10
Til: php-windows@xxxxxxxxxxxxx
Emne:  Random

"How can I create a random string"

rand() only returns an int (number), but I would like something like
dd75$6*, you know, containing any character. I would like it only to do
a certain string ONCE, so there are no duplicates (in a for loop).
Hopefully I won't need to do a huge array. Any suggestions?

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux