Random Numbers
Random Numbers
So what's the best way to generate random numbers? I don't see anything for this in the libraries. I can write a random number generator on my own but I still need to seed it. My guess is that I can use the noise generator to seed it but I'm not sure if I create a noise generator whether it's going to always give the same random sequence in which case it wouldn't be good for a seed or if it's "running in the background all the time" so when I get it is just some random spot in it's ongoing random sequence in which case it's probably fine for a seed. I'm just curious what other people are doing here and if perhaps I missed a library call which will handle it without any effort on my part.
Re: Random Numbers
in VM - Noise + sample and hold, in code - java.lang.Math.random()
Re: Random Numbers
Doh! Yes, I saw this just after posting. I guess I didn't realize I had the standard Java libraries available to me. Color me red with embarrassment.