DiUS / java-faker

Brings the popular ruby faker gem to Java
http://dius.github.io/java-faker
Other
4.77k stars 851 forks source link

lorem().characters() method sometimes does not include digit. #759

Open swaroop-tata opened 1 year ago

swaroop-tata commented 1 year ago

Describe the bug lorem().characters() method sometimes does not include digit.

To Reproduce Run "lorem().characters(7,true,true)" this in a loop. Observe that some times, the generated string will miss digit.

Expected behavior A digit must include every time when includeDigit is used.

Versions:

Additional context

bodiam commented 1 year ago

You'd best use https://github.com/datafaker-net/datafake instead, which is an active fork of this library.

bodiam commented 1 year ago

I don't think this is a bug though, it's an option to include numbers. Not always they will be included. If you want to force numbers, you can use something like bothify, regexify, or examplify.

swaroop-tata commented 1 year ago

Thank you for the response.

snuyanzin commented 1 year ago

In datafaker there is a special Text provider where it's possible to specify minimum number of occurrencies per symbol. I guess, even more it's possible to specify other symbols e.g. from non English abc, it will satisfy your case. For more details https://github.com/datafaker-net/datafaker/blob/main/src/test/java/net/datafaker/providers/base/TextTest.java