xdrop / jRand

A Java library to generate random data for all sorts of things. Java random data faker
Apache License 2.0
27 stars 14 forks source link

Generate Mulitple of specific integer with NaturalGenerator #46

Open KEN-00 opened 5 years ago

KEN-00 commented 5 years ago

Hi . I would like to ask is there a way to generate a random natural number which is a multiple of a specific factor n?

For example:

int factor = 3;
NaturalGenerator naturalGenerator = JRand.natural();
naturalGenerator.min(0);
naturalGenerator.max(999);
//do something with factor
int randomMultiple = naturalGenerator.gen();