Seeding the randomizer?

Is there a way I can feed a specific seed to Unity’s randomizer? (Which, I assume, uses a time-based seed normally?)

I want REPEATABLE randomness: so every time I use a given seed, my radomly-placed objects to appear in the same positions. Or change the seed and I get another arrangement–but always reproducible. Ditto for randomly generated terrains or other effects.

This would be useful for making certain parts of some levels. Random is MUCH quicker than placing thousands of objects by hand… but I want the levels to be the same when re-played.

(I know that motion and physics-based responses will vary from play to play due to timing, I just want my terrain and random items to start the same each session. Then after level setup I’ll probably re-seed using time and/or mouse, so the enemies do not act the same each play.)

You probably want to use .NET’s System.Random class instead of UnityEngine.Random. Check out the Mono documentation on this subject here.

Thanks - I’ll explore that.