commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duncan Jones (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (TEXT-37) Global vs local source of randomness
Date Tue, 27 Dec 2016 08:58:58 GMT

     [ https://issues.apache.org/jira/browse/TEXT-37?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Duncan Jones closed TEXT-37.
----------------------------
    Resolution: Fixed
      Assignee: Duncan Jones

Fixed as part of 08ac56a50.

> Global vs local source of randomness
> ------------------------------------
>
>                 Key: TEXT-37
>                 URL: https://issues.apache.org/jira/browse/TEXT-37
>             Project: Commons Text
>          Issue Type: Improvement
>            Reporter: Gilles
>            Assignee: Duncan Jones
>              Labels: api, constructor
>             Fix For: 1.0
>
>
> This is a follow-up of a [discussion|https://issues.apache.org/jira/browse/TEXT-34?focusedCommentId=15761636&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15761636]
held in TEXT-34.
> By default, {{RandomStringBuilder}} will use a shared {{java.util.Random}} object.
> I think that the decision of which generator to use lies with the code that _constructs_
the {{RandomStringBuilder}} instance, not with code that _uses_ it (to build a string).
> It would be safer to pass the RNG instance at construction (since, anyways, the constructor
must be called):
> {code}
> RandomStringBuilder sb = new RandomStringBuilder(new MyRandom());
> String s = sb.ofLength(length).build();
> {code}
> In the above, the {{MyRandom}} type is the subject of TEXT-36.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message