Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+17 votes
asked in CSC211_Winter2018 by (8 points)

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 (8 points)
+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 (9.1k points)
...