"Seed uses the provided seed value to initialize the default Source to a deterministic state. If Seed is not called, the generator behaves as if seeded by Seed(1). "
Also, am I seeding math.rand correctly in the Init() function? Will seeding it in the Init() function override any seeding I do in my tests?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If you want to test what your solution does when it receives a randomly-generated number, then you don't need to use random numbers. You can hide the generation of the random number in a type which is defined by an interface. Then you can supply a dummy version of the type which supplies numbers that you choose specifically for your test. So for example, if you want to test what your solution does when it receives a randomly-generated number less than 10, you set up a test that supplies it with 8.
On the other hand, if you want to test the random number generator, for example to test its randomness, then this approach is no good.
Simon