# Thread: Can I get a random number , between two randoms?

1. Member
Join Date
Jun 2015
Posts
14
Rep Power
0

## Can I get a random number , between two randoms?

Hello guys , i need to know if i could get a random number between two randoms ?
Java Code:
```                        Random generator = new Random();
int generator1 = generator.nextInt(7);

//if generator1 =5;

Random randomIndex = new Random();
int randomIndex1 = randomIndex .nextInt(8);

//if randomIndex1 =3;

Random randomBetween = new Random();
int randomBetween1 = //I need randomBetween1 to be 5 or 3```

2. ## Re: Can I get a random number , between two randoms?

get a random number between two randoms ?
Use the difference between the two numbers as the range to generate a random number then add the lower number to move it to between the low and high number

3. ## Re: Can I get a random number , between two randoms?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•