You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Duncan Jones <du...@wortharead.com> on 2016/12/18 07:04:59 UTC

Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

> On 18 Dec 2016, at 06:55, Gary Gregory <ga...@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" <du...@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 <du...@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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sun, 18 Dec 2016 10:23:34 +0000, sebb wrote:
> On 18 December 2016 at 07:04, Duncan Jones <du...@wortharead.com> 
> wrote:
>>
>>> On 18 Dec 2016, at 06:55, Gary Gregory <ga...@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.
>
> I think this belongs in TEXT rather than LANG or RNG

+1

>
> Just because it involves random choices does not mean it belongs in 
> RNG.

+1

> It is an application of a random generator.

+1

>
> It's definitely too specialised for LANG.

+1

> It should be able to *use* RNG for the generator if required.

+1


Gilles

>
>> Duncan
>>
>>>
>>> On Dec 17, 2016 10:39 PM, "Duncan Jones" <du...@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 <du...@wortharead.com> 
>>>>> wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I\u2019ve 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\u2019ve possibly
>>>> overcomplicated the predicate stuff, however it seemed the most 
>>>> flexible
>>>> way to specify requirements on the letters. I\u2019ve 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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by Gary Gregory <ga...@gmail.com>.
+1 to moving this to Text. New code goes in Text. Old code is deprecated
and copied.

Gary

On Dec 18, 2016 5:05 AM, "Rob Tompkins" <ch...@gmail.com> wrote:

>
>
> > On Dec 18, 2016, at 6:10 AM, Pascal Schumacher <pa...@gmx.net>
> wrote:
> >
> >> Am 18.12.2016 um 11:57 schrieb Duncan Jones:
> >>
> >>> On 18 Dec 2016, at 10:51, sebb <se...@gmail.com> wrote:
> >>>
> >>> On 18 December 2016 at 10:40, Pascal Schumacher
> >>> <pa...@gmx.net> wrote:
> >>>>> Am 18.12.2016 um 11:23 schrieb sebb:
> >>>>> It's definitely too specialised for LANG.
> >>>> I do not think this is too specialized for LANG. RandomStringUtils
> has been
> >>>> part of LANG since 1.0, and this is just an improved version of
> existing
> >>>> functionality.
> >>> I don't think RandomStringUtils itself belongs in LANG, now that there
> >>> is a TEXT component.
> >>>
> >>> Quite a few TEXT-like classes were added to LANG because there was
> nowhere else.
> >> I agree with this. Creating random strings is not really a missing
> feature from java.lang.*.
> >>
> >> We should add a similar class to TEXT, but take the opportunity to
> simplify some of the complicated semantics of the current version. We can
> then deprecated RandomStringUtils and remove it in 4.0.
> >
> > What about adding only your new methods (removing the Unicode suffix) as
> RandomStringUtils to text?
> >
>
> Based on our last conversation about TEXT, the line between LANG and TEXT
> seems to be if an arbitrary application developer would find the utility
> useful on a day to day basis, then LANG is the spot for it. Otherwise, the
> developer is writing something that actually processes and manipulates
> text, which seems to be the use case for TEXT.
>
> So this feels more "texty" than "langy" to me, but I could go either way.
>
> Also, my goal is to get TEXT ready to go out in the next month or so
> (granted I've not done a release before, so I might need guidance there).
>
> Cheers,
> -Rob
>
> > ---------------------------------------------------------------------
> > 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
>
>

Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by Rob Tompkins <ch...@gmail.com>.

> On Dec 18, 2016, at 6:10 AM, Pascal Schumacher <pa...@gmx.net> wrote:
> 
>> Am 18.12.2016 um 11:57 schrieb Duncan Jones:
>> 
>>> On 18 Dec 2016, at 10:51, sebb <se...@gmail.com> wrote:
>>> 
>>> On 18 December 2016 at 10:40, Pascal Schumacher
>>> <pa...@gmx.net> wrote:
>>>>> Am 18.12.2016 um 11:23 schrieb sebb:
>>>>> It's definitely too specialised for LANG.
>>>> I do not think this is too specialized for LANG. RandomStringUtils has been
>>>> part of LANG since 1.0, and this is just an improved version of existing
>>>> functionality.
>>> I don't think RandomStringUtils itself belongs in LANG, now that there
>>> is a TEXT component.
>>> 
>>> Quite a few TEXT-like classes were added to LANG because there was nowhere else.
>> I agree with this. Creating random strings is not really a missing feature from java.lang.*.
>> 
>> We should add a similar class to TEXT, but take the opportunity to simplify some of the complicated semantics of the current version. We can then deprecated RandomStringUtils and remove it in 4.0.
> 
> What about adding only your new methods (removing the Unicode suffix) as RandomStringUtils to text?
> 

Based on our last conversation about TEXT, the line between LANG and TEXT seems to be if an arbitrary application developer would find the utility useful on a day to day basis, then LANG is the spot for it. Otherwise, the developer is writing something that actually processes and manipulates text, which seems to be the use case for TEXT. 

So this feels more "texty" than "langy" to me, but I could go either way. 

Also, my goal is to get TEXT ready to go out in the next month or so (granted I've not done a release before, so I might need guidance there). 

Cheers,
-Rob

> ---------------------------------------------------------------------
> 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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by Pascal Schumacher <pa...@gmx.net>.
Am 18.12.2016 um 11:57 schrieb Duncan Jones:
>
>> On 18 Dec 2016, at 10:51, sebb <se...@gmail.com> wrote:
>>
>> On 18 December 2016 at 10:40, Pascal Schumacher
>> <pa...@gmx.net> wrote:
>>> Am 18.12.2016 um 11:23 schrieb sebb:
>>>> It's definitely too specialised for LANG.
>>> I do not think this is too specialized for LANG. RandomStringUtils has been
>>> part of LANG since 1.0, and this is just an improved version of existing
>>> functionality.
>> I don't think RandomStringUtils itself belongs in LANG, now that there
>> is a TEXT component.
>>
>> Quite a few TEXT-like classes were added to LANG because there was nowhere else.
> I agree with this. Creating random strings is not really a missing feature from java.lang.*.
>
> We should add a similar class to TEXT, but take the opportunity to simplify some of the complicated semantics of the current version. We can then deprecated RandomStringUtils and remove it in 4.0.

What about adding only your new methods (removing the Unicode suffix) as 
RandomStringUtils to text?

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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by Duncan Jones <du...@wortharead.com>.
> On 18 Dec 2016, at 10:51, sebb <se...@gmail.com> wrote:
> 
> On 18 December 2016 at 10:40, Pascal Schumacher
> <pa...@gmx.net> wrote:
>> Am 18.12.2016 um 11:23 schrieb sebb:
>>> 
>>> It's definitely too specialised for LANG.
>> 
>> I do not think this is too specialized for LANG. RandomStringUtils has been
>> part of LANG since 1.0, and this is just an improved version of existing
>> functionality.
> 
> I don't think RandomStringUtils itself belongs in LANG, now that there
> is a TEXT component.
> 
> Quite a few TEXT-like classes were added to LANG because there was nowhere else.

I agree with this. Creating random strings is not really a missing feature from java.lang.*.

We should add a similar class to TEXT, but take the opportunity to simplify some of the complicated semantics of the current version. We can then deprecated RandomStringUtils and remove it in 4.0.


> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by sebb <se...@gmail.com>.
On 18 December 2016 at 10:40, Pascal Schumacher
<pa...@gmx.net> wrote:
> Am 18.12.2016 um 11:23 schrieb sebb:
>>
>> It's definitely too specialised for LANG.
>
> I do not think this is too specialized for LANG. RandomStringUtils has been
> part of LANG since 1.0, and this is just an improved version of existing
> functionality.

I don't think RandomStringUtils itself belongs in LANG, now that there
is a TEXT component.

Quite a few TEXT-like classes were added to LANG because there was nowhere else.

>
>
> ---------------------------------------------------------------------
> 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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by Pascal Schumacher <pa...@gmx.net>.
Am 18.12.2016 um 11:23 schrieb sebb:
> It's definitely too specialised for LANG.
I do not think this is too specialized for LANG. RandomStringUtils has 
been part of LANG since 1.0, and this is just an improved version of 
existing functionality.


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


Re: [LANG] [RNG] New Unicode-capable additions to RandomStringUtils

Posted by sebb <se...@gmail.com>.
On 18 December 2016 at 07:04, Duncan Jones <du...@wortharead.com> wrote:
>
>> On 18 Dec 2016, at 06:55, Gary Gregory <ga...@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.

I think this belongs in TEXT rather than LANG or RNG

Just because it involves random choices does not mean it belongs in RNG.
It is an application of a random generator.

It's definitely too specialised for LANG.

It should be able to *use* RNG for the generator if required.

> Duncan
>
>>
>> On Dec 17, 2016 10:39 PM, "Duncan Jones" <du...@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 <du...@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
>

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