Back to Intellij Community

UnsecureRandomNumberGeneration

java/java-impl/resources/inspectionDescriptions/UnsecureRandomNumberGeneration.html

2025.3-rc-2268 B
Original Source

Reports any uses of java.lang.Random or java.lang.Math.random().

In secure environments, java.secure.SecureRandom is a better choice, since is offers cryptographically secure random number generation.

Example:

long token = new Random().nextLong();