[ 
https://issues.apache.org/jira/browse/LANG-1382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16384350#comment-16384350
 ] 

Gilles commented on LANG-1382:
------------------------------

bq. JDKRandom

You shouldn't access implementation classes, but instantiate a 
{{UnifomRandomProvider}} (client API) through the {{RandomSource.create}} 
factory method; see e.g. the 
[userguide|http://commons.apache.org/proper/commons-rng/userguide/rng.html#a2._Usage_overview].
  And, please note that any of [the other implemented algorithms are better 
than 
{{JDKRandom}}|http://commons.apache.org/proper/commons-rng/userguide/rng.html#a5._Quality].

bq. there's still functionality missing to create values in between a specified 
range.

It is provided by 
[DiscreteUniformSampler|http://commons.apache.org/proper/commons-rng/commons-rng-sampling/apidocs/org/apache/commons/rng/sampling/distribution/DiscreteUniformSampler.html].

> Provide method to generate random numbers without range restriction for all 
> numeric types
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-1382
>                 URL: https://issues.apache.org/jira/browse/LANG-1382
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Karl Richter
>            Priority: Major
>
> `RandomUtils` only allows to generate random numbers of different numeric 
> types (`byte`, `short`, `double`, etc.) within the range 0 (inclusive) and 
> the maximum value of the respective type. It'd be nice if there were methods 
> to create random numbers for the range between the minimal and the maximal 
> value for all numeric types.
> I'm aware of workarounds like 
> https://stackoverflow.com/questions/27976857/how-to-get-random-number-with-negative-number-in-range,
>  but they're not tested and require quite some thinking which can be avoided 
> (which is afaik one of the many motivations for the Apache commons libraries).
> If such methods already exist they should be definitely linked in the Javadoc 
> of `RandomUtils`.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to