Generation of the same sequence of random numbers

后端 未结 5 1858
广开言路
广开言路 2021-01-07 20:42

I want to generate random numbers in java, I know I should use existing methods like Math.random(), however, my question is: how can I generate the same sequence of numbers,

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-07 21:32

    I'd hardcode the numbers into the app. This takes more memory but is much faster.

    Just print random numbers to the terminal, then copy-paste them to your code.

    Be sure to leave a comment explaining what you have done, or they will look like black magic to the uninformed reader.

提交回复
热议问题