Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+17 votes
asked in CSC211_Winter2018 by (1 point)

2 Answers

+7 votes

Yes, you can use a while loop with randGen.nextInt in order to constantly be creating new random numbers.

answered by (1 point)
+2 votes

You certainly can keep generating an infinite number of pseudo-random numbers, but as a side note, eventually the sequence will repeat and you will start getting the same sequence of numbers again, because of the algorithm used to generate the numbers.

However, this will only happen after many billions of numbers, and as a practical matter, it shouldn't affect any Java code that you write...

answered by (3.5k points)
...