I don't think there is a right or wrong answer to this question...it depends upon context. Math.random is static, and so can be easily accessed across classes and this alone may make it more often...
Type: Posts; User: copeg
I don't think there is a right or wrong answer to this question...it depends upon context. Math.random is static, and so can be easily accessed across classes and this alone may make it more often...
As a side note: behind the scenes, Math.random uses a static instance of Random and its nextDouble function to generate a random number. IMO that 'middle man' design makes getting a random number...
You should draw the random prior to initiating the loop. I don't know what getRanNumber() actually does because the code isn't posted for it, but based upon this it doesn't look like its needed
...