A secure random number is one where the next random number is not

predictable from the previous one, the current system time, or some other

value.

Remember that computer-generated random numbers are never truly random

(they are technically called pseudo-random). They are always computed in

some way or another. So random numbers are always somewhat predictable

just by following the algorithm. For instance, if you use the digits of PI

as random numbers, then all you have to do to get the next one is find out

which digit of PI you used last, and then you already know what the next

one will be (e.g., if the last one was the 1765th digit, then the next one

will be the 1766th digit).

A secure random number generator uses an algorithm that makes it very

difficult to guess what the next value will be.

BTW, there also is one way of getting 100% secure random numbers: there

are hardware-based random number generators that use things like heat

oscillations, quantum effects, radioactive decay or other physical random

effects rather than pure software. Those are the only true random number

generators available for computers.

On Mon, 28 Jul 2003 20:49:57 +0000, Phil wrote:

Pls excuse ignorance on my part but what is a secure random number?

"Rob" <rs*******@hotmail.com> wrote in message

news:3f******@news.sentex.net... Actually, my code does some simulation according the generated numbers,

I dont need them to be secured, but i need to use a different random

generation algorithm, and compare the results, right now I am using :

Random pk = new Random();

int a = pk.nextInt(540);

So I need to know if the Math.random() using a different algorithm than

above method, or if there is any other way to generate random numbers.

Thanks-Rob

"Chris" <ch*******@hotmail.com> wrote in message

news:tb********************@news1.telusplanet.net. .. > -----BEGIN PGP SIGNED MESSAGE-----

> Hash: SHA1

>

> Rob wrote:

>

> > He ,

> > I need to generate some random numbers, right now I am using:

> > Random pk = new Random();

> > int a = pk.nextInt(540);

> >

> > and wondering if there is any other methods in java to generate

> > random numbers.

> >

> > Thanks for any help.

> > Rob

>

> Hi,

> In addition to Ingo's suggestion that if you need secure numbers, use

> SecureRandom, there is also a method java.lang.Math.random() which

> returns a double from 0.0 (inclusive) to 1.0 (exclusive). It's just a

> shortcut for creating a java.util.Random object and calling

> nextDouble() on it. Also, if you're working with large numbers, you

> could take a look at java.math.BigInteger's constructors

> BigInteger(int bitLength, int certainty, Random rnd) and

> BigInteger(int bitLength, Random rnd) which both generate random

> prime numbers (might not be useful to you though). Of course, if you

> need a securely generated BigInteger prime, just use one of those

> constructors with a SecureRandom as the last parameter (since

> SecureRandom extends Random).

>

> - --

> Chris

> -----BEGIN PGP SIGNATURE-----

> Version: GnuPG v1.2.2 (GNU/Linux)

>

> iD8DBQE/I8zhwxczzJRavJYRAqHlAKDM1NWKw6St2M0DpE25cxlOyO0ZzA CgyDSQ

> +oE8IrnUlNbuVZ/c02ScIa4=

> =2WZy

> -----END PGP SIGNATURE-----

--

Keep American Families united! Support H.R. 539 and H.R. 832

For more information, see

http://www.kkeane.com/lobbyspousal-faq.shtml