...
Code Block | ||
---|---|---|
| ||
import java.util.Random; // ... Random number = new Random(123L); //... for (int i=0; i<20; i++) { // generate another random integer in the range [0,20] int n = number.nextInt(21); System.out.println(n); } |
There are cases of course, where the same sequence of random numbers is desirable, e.g. regression tests of program behavior.
If there is no such a case, a same sequence of random numbers may cause a vulnerability.
Noncompliant Code Example
...