The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 2002

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

java.util.Random

Posted by senthoor on February 19, 2002 at 7:11 AM

What I suggest is for you to use the java.util.Random class for Random number generation. The code below might help you....

import java.util.Random;
public class MyRandom {

public MyRandom() {
}
public static void main(String args[])
{
Random x = new Random();
System.out.println(x.nextInt(101));

}
}



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us