Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Kaua Costa   on Feb 21 In Java Category.

  
Question Answered By: Taylor Evans   on Feb 21

Yes, or use the overloaded "nextInt" method

// number  betwwen 1 y 100 inclusive
Random random  = new Random( 10 );
int number = random.nextInt( 100 ) + 1;

From
java.sun.com/.../Random.html
int nextInt(int n)
Returns a pseudorandom, uniformly distributed int value
between 0 (inclusive) and the specified value (exclusive), drawn from
this random number generator's sequence.

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Problem with random number in java Or get search suggestion and latest updates.


Tagged: