Search:

Type: Posts; User: copeg

Search: Search took 0.11 seconds.

  1. Replies
    7
    Views
    9,550

    Re: Can a for loop work with random number?

    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...
  2. Replies
    7
    Views
    9,550

    Re: Can a for loop work with random number?

    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...
  3. Replies
    7
    Views
    9,550

    Re: Can a for loop work with 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


    ...
Results 1 to 3 of 3