You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2024/07/06 18:56:00 UTC

[jira] [Resolved] (LANG-1254) ThreadLocalRandom should be used in utility classes

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

Gary D. Gregory resolved LANG-1254.
-----------------------------------
    Fix Version/s: 3.13.0
       Resolution: Fixed

> ThreadLocalRandom should be used in utility classes
> ---------------------------------------------------
>
>                 Key: LANG-1254
>                 URL: https://issues.apache.org/jira/browse/LANG-1254
>             Project: Commons Lang
>          Issue Type: Improvement
>            Reporter: John Mark
>            Priority: Minor
>             Fix For: 3.13.0
>
>
> I noticed that both {{RandomUtils}} and {{RandomStringUtils}} use a constant for the {{Random}} instance. The javadoc for [Random|http://docs.oracle.com/javase/8/docs/api/java/util/Random.html] indicates that [ThreadLocalRandom|http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadLocalRandom.html] should be used for performance in multithreaded designs. I would think that a public utility class would qualify as a multithreaded design and should therefore use {{ThreadLocalRandom}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)