Padraic, >>> Technically, it will be harder than uniqid() if producing strictly >>> random bytes (if output needs to be printable/readable). >>> That's not a "bad" thing obviously! >> >> Sure. But does that indicate the need for a "random_string()" function? > > It would be more random than a stream of 0-9 integer characters, and > probably useful compared to base64'ing a byte stream. I'm afraid to go > survey how its done in the wild right now. Possibly?
I've done it two ways: Bitmasks: https://github.com/ircmaxell/RandomLib/blob/master/lib/RandomLib/Generator.php#L228 String of characters: https://github.com/ircmaxell/random_compat/blob/master/lib/random.php#L147 I think the latter is the easiest, especially if we define constants with "normal" char lists: "ALPHA", "ALPHA_NUMERIC", "BASE64", etc and default to "ALPHA_NUMERIC"... Tho I am sure there are other ways out there. Anthony -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php