Java – use random What is the importance of setseed?
•
Java
When writing Java programs, we use setseed. Com in the random class Why do we use this method?
Can't we use random without using setseed? What is the main purpose of using setseed?
Solution
One use of this is that it enables you to reproduce the results of your program in the future
For example, I want to calculate a random variable for each row in the database I want the program to reproduce, but I want randomness between lines To do this, I set the random number seed as the primary key of each row So, when I run the program again, I get the same result, but between lines, the random variables are pseudo-random
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码