Re: [go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-16 Thread Simon Ritchie
As some posters have already said, it depends what you are trying to test. 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

Re: [go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-16 Thread Michael Jones
You could also capture a (p)random stream as a test data vector and use it in lieu of the PRNG during tests. This is the same as seeding iff and only iff the PRNG is never changed, Should that change, then so will the tests unless you capture a test vector now. (For example, if you have a timing