I've created a procedural image generator that uses the default PNRG built in PHP5.
I can set the seed with mt_srand($id);
and get always the same numbers sequence (with mt_rand(0,255);
).
What I need:
a PNRG implementation that will work the exact same way in PHP and C#
Example:
PHP:
mt_srand(123);
echo mt_rand(0,255); //returns 34
echo mt_rand(0,255); //returns 102
echo mt_rand(0,255); //returns 57
echo mt_rand(0,255); //returns 212
echo mt_rand(0,255); //returns 183
C#:
setSeed(123);
print getRand(0,255); //returns 34
print getRand(0,255); //returns 102
print getRand(0,255); //returns 57
print getRand(0,255); //returns 212
print getRand(0,255); //returns 183
( ^ function names are not referring to existing ones, named just for example's sake )
Aucun commentaire:
Enregistrer un commentaire