Random text generator

What is the best way to generate a random string consisting of alphabets and its maximum of 8 million characters to be tested using string search algorithms? Is Math.random still ok for randomness or robustness based on statistics? any comment is appreciated, correctly, if I am mistaken in my ideas.

+5
source share
4 answers

Of course, why not? 8 MiB is not so much. Even bad PRNGs have periods of at least a few billion, and Java uses a 48-bit LCG. So yes, that should be good.

+1
source

. , , , , .

Markov Chain, ; "The", ; "The" → "first". , Brown Corpus.

, , (, Brown Corpus), .

+1
source

This commons-lang library class does the job

org.apache.commons.lang.RandomStringUtils

You can use the "random" method

String s = org.apache.commons.lang.RandomStringUtils.random(5, true, false);
0
source

All Articles