views:

164

answers:

2

I'm working on a project with remote Flash developers, and they have requested that when my PHP application sets up the HTML to load their Flash object, I pass in a seed that they can use to generate random numbers with (the seed is stored so that a particular game can be replayed later).

If you were seeding PHP's RNG, you might use the old standby (double)microtime()*1000000. However, it occurred to me that if I generate a seed using this method, I'd have a smaller range than if I just used a regular rand() or mt_rand() call.

Since the number is being generated for external consumption as a seed, and not seeding my own generator, is there anything else to consider? Is there a better method than a regular old mt_rand(), which would give me 2^31 possible results on 32-bit architecture?

It's not being used for anything fancy, just to throw a little randomness into a flash game.

A: 

It looks like you're not looking for government-grade security/randomness here - so mt_rand() would be a just fine approach.

Alex
A: 

How about random.org?

nikc