commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duncan Jones <dun...@wortharead.com>
Subject Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils
Date Sun, 18 Dec 2016 07:04:59 GMT

> On 18 Dec 2016, at 06:55, Gary Gregory <garydgregory@gmail.com> wrote:
> 
> I thought we were talking about deprecating any random code in favor of
> Commons RNG?
> 
> Gary

I guess that depends on the scope of RNG. Our previous conversation about RandomUtils made
sense (LANG-1299), since that was about the functionality offered by the generator itself.

If RNG will become a repository of things you could do with a random generator, rather than
just implementations of the generators, then I agree with your suggestion. If not, then I
could imagine this random string generation staying in Lang or perhaps moving to Text.

Duncan

> 
> On Dec 17, 2016 10:39 PM, "Duncan Jones" <duncan@wortharead.com> wrote:
> 
>> On reflection, a bad choice of subject line. The other methods are
>> Unicode-capable, but just very rooted in thinking about char data types.
>> 
>>> On 18 Dec 2016, at 06:38, Duncan Jones <duncan@wortharead.com> wrote:
>>> 
>>> Hi all,
>>> 
>>> I’ve created a variation of RandomStringUtils.random(), which generates
>> the specified number of code points (rather than chars).
>>> 
>>> Implementation can be seen here (https://gist.github.com/dmjones500/
>> da2f61a0234f428748417bf1443c0dff).
>>> 
>>> Signature is:
>>> 
>>> public static String randomUnicode(final int count, final int
>> minCodePoint, final int maxCodePoint,
>>>           final Set<CodePointPredicate> include, final Random random)
>>> 
>>> 
>>> Expected overloads:
>>> 
>>> 
>>> public static String randomUnicode(final int count, final int
>> minCodePoint, final int maxCodePoint, final Set<CodePointPredicate> include)
>>> public static String randomUnicode(final int count, final int
>> minCodePoint, final int maxCodePoint)
>>> public static String randomUnicode(final int count)
>>> 
>>> And possibly:
>>> 
>>> public static String randomNumberUnicode(final int count)
>>> public static String randomAlphabeticUnicode(final int count)
>>> public static String randomAlphanumericUnicode(final int count)
>>> 
>>> 
>>> Any complaints if I add this to the code base? I’ve possibly
>> overcomplicated the predicate stuff, however it seemed the most flexible
>> way to specify requirements on the letters. I’ve created two built-in
>> predicates, but more could be supported (and users can create their own).
>>> 
>>> Duncan
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message