SecureRandom generates random numbers which are truely random, but
slow. java.math.Random generates psuedorandom numbers quite quickly.
It all depends on what you want.
Jim
Stanley Ho wrote:
>
> use SecureRandom class in
> import java.security.SecureRandom;
>
> /* generate a random object use: */
> SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
>
> /* see the provider of the random number: */
> System.out.println("Random provider: " + random.getProvider());
>
> /* After the caller obtains the SecureRandom object from the getInstance
> call, it can call nextBytes to generate random bytes: */
>
> byte bytes[] = new byte[20];
> random.nextBytes(bytes);
>
> Hope it helps.
>
> -Stanley
>
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> pradeep
> Sent: Monday, October 25, 1999 1:32 AM
> To: [EMAIL PROTECTED]
> Subject: Generating random Registration Numbers
>
> Hi All,
>
> Can anybody please suggest me on the algorthims,info or links where the
> "generating random registration numbers" is discussed.
>
> -pradeep
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html