tags:

views:

47

answers:

1

I am trying to create a random string based on a fixed string. I'd like to be able, if at all possible, create the same random string (i know its an oxymoron) provided I use the same seed. like so:

$base = '0123456789abcdef';
$seed = 'qwe123';

function getRandStr($base, $seed) { }

such that so long as I give the same $base and $seed I always get the same random string?? I am sing PHP.

+2  A: 

Yes, with mt_srand you can specify the seed for the "better" random number generator mt_rand.

Artefacto