Replace a single-use Random with ThreadLocalRandom

Proprietary

Replaces a new java.util.Random() used only once, as in new Random().nextInt(10), or held in a local variable used only to draw values, with ThreadLocalRandom.current(), removing the variable. Leaves alone setSeed, seeded instances, subclasses, fields, locals in constructors or static main, locals passed on, reassigned or captured by a lambda or class, Java 6 code and test sources.

io.moderne.staticanalysis.ReplaceSingleUseRandomWithThreadLocalRandom
mod run . --recipe=io.moderne.staticanalysis.ReplaceSingleUseRandomWithThreadLocalRandom

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.