'My PRNG use is safe; how do I tell SonarQube not to yell at me

I am using java.util.Random to append random numbers to the names of some objects in a testing environment. I do these random values will never be used in any cryptography contexts. The instruction from SonarQube is "Make sure that using this pseudorandom number generator is safe here." I have, indeed, "made sure". Thank you, SonarQube, for your diligence.

Now what?



Solution 1:[1]

The answer is

@SuppressWarnings("squid:S2245") // this PRNG usage is safe
private static final Random random = new Random();

Props to SonarQube for hooking into the SuppressWarnings annotation, slops for the name of the identifier

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 R. Woods