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: Cay Nguyen   on Feb 21

You need to initialize the random  Class with a seed, if you don't do
it, the seed is base in the time  and it is diferent each time.

use a fixed long for seed
Random random = new Random( 10 );
int number  = random.nextInt();

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: