Reuse Random Objects & Use SecureRandom

jSparrow 3.20.0 & jSparrow Maven Plugin 2.17.0 released

The focus of the new rules for jSparrow’s 3.20.0 release is on securing random number generators.

Reuse Random Objects

This rule extracts reusable java.util.Random objects from local variables to class or instance fields. The goal is to improve the unpredictability of the generated values. Moreover, the rule reduces the number of objects created by the program. For instance, the following code:

is refactored to:

Use SecureRandom

This rule replaces pseudo-random number generators (PRNG), i.e., instances

of Random with cryptographically strong random number generators (RNG), i.e., instances of SecureRandom. For instance, the following code snippet:

is refactored to:

This brings jSparrow to a total of 81 automatic refactoring rules.

Find out more information in the Release Notes for jSparrow Eclipse and jSparrow Maven!

“Creativity is the ability to introduce order into the randomness of nature.”

― Eric Hoffer

Happy Coding!