commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject [math] Making PRNG pluggable in o.a.c.m.random classes
Date Sun, 08 May 2005 05:31:55 GMT
Here is the plan that I proposed a while back.  Better ideas /
improvements welcome.  Also, can someone confirm that step 1 below is
OK from license/IP perspective?  - thx

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()

2) Add constructors to RandomDataImpl and ValueServer that take
RandomGenerator arguments and setGenerator(RandomGenerator) methods.
Leave the "secure" methods and SecureRandom members alone - the "secure"
PRNG is already pluggable.

3) Add sample code to the User Guide showing how to create an adaptor
for RngPack, or, alternatively, introduce a compile-time dependency on
RngPack and add the adaptor.

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message