33.6k views
4 votes
Type two statements that use nextint() to print 2 random integers between (and including) 100 and 149. end with a newline. ex: 112 102

2 Answers

6 votes

Answer:

randGen.setSeed(seedVal);

System.out.println(randGen.nextInt(50) + 100);

System.out.println(randGen.nextInt(50) + 100);

Explanation:

Type two statements that use nextint() to print 2 random integers between (and including-example-1
User Micah Kornfield
by
6.2k points
6 votes

NB- Solution is emboldened

import java.util.Scanner;

import java.util.Random;

public class RandomGenerateNumbers {

public static void main (String [] args) {

Random randGen = new Random();

int seedVal = 0;

seedVal = 4;

randGen.setSeed(seedVal);

System.out.println(randGen.nextInt(50) + 100);

System.out.println(randGen.nextInt(50) + 100);

return;

}

}

User Dinesh Patra
by
5.9k points