[2758] in java-interest

home help back first fref pref prev next nref lref last post

Re: Math.srandom()

daemon@ATHENA.MIT.EDU (Thomas Ball)
Thu Oct 12 19:31:31 1995

Date: Thu, 12 Oct 1995 14:24:28 -0700
From: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
To: suresh@thomtech.com
Cc: java-interest@java.Eng.Sun.COM

>  Is this an omission?  The Math class does not have the srandom
>  method (to seed the random number generator) in pre-beta.

It's intentional.  If you just want some fairly pseudo-random numbers,
Math.random works fine (it seeds with System.currentTimeMillis()).  If
you want more control, use java.util.Random -- one of its constructors
allows you to specify the seed of your choice.  This is especially
useful for testing (use the same specific seed), but is also used when
you need to use a more random seed for tighter security.

Tom Ball
Java Products Group
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post