> >1) Extract the interface from java.util.Random -- same names and > >contracts. Call this interface RandomGenerator. It will contain: > > > >setSeed(long seed) > >nextBytes(byte[] bytes) > >int nextInt() > >int nextInt(int n) > >long nextLong() > >boolean nextBoolean() > >double nextDouble() > >float nextFloat() > >double nextGaussian() > >
I would prefer to separate out these generation methods into different types. IMO, the RandomGenerator interface should contain a sole generation method. One of: int next(int numberOfBits) // similar to the java.util.Random method int next() // discrete uniform over [0, Integer.MAX_VALUE] double next() // uniform over [0, 1) The remaining methods I would implement as specialized random variable generators that use a RandomGenerator instance as an engine. Brent Worden --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]