Index: [thread] [date] [subject] [author]
  From: Tim Bain <tpb2@duke.edu>
  To  : 
  Date: Sun, 28 Mar 1999 15:44:44 -0500

Re: Java help?

Angelique Coviello wrote:

> Ok, so I found some of the stuff I was looking for, I even found some
> specific java.math stuff, but I still can't find anything about the
> random number bit.  I'm also not clear on how to/whether we need to
> "include" the java.math class as you do with C++.
>
> Thanks,
> Angel

Angel, I didn't find anything in java.math, either.  However,
I did find a class called Random in the java.util library.  It has
a few procedures for creating random numbers of various
types:

nextDouble() returns a double (0.0 <= x < 1.0)
nextFloat() returns a float (0.0 <= x < 1.0)
nextLong() returns a long between the highest and lowest longs
nextInt() returns a int between the highest and lowest ints

You can set the seed value with a call to:
setSeed(long)

I hope this does what you need!

Tim



Index: [thread] [date] [subject] [author]