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

Alex Herbert commented on RNG-161:
----------------------------------

Can you explain your use case?

If you just require a single random number each time then you can generate it 
using RandomSource:

{code:java}
long l = RandomSource.createLong();
int i = RandomSource.createInt();
{code}

These methods are thread safe, with high performance and a statistically robust 
output.

The integers can be converted to floating-point numbers using the methods in 
the {{org.apache.commons.rng.core.util.NumberFactory}} class:

{code:java}
double d = NumberFactory.makeDouble(RandomSource.createLong());
{code}

If you require seeding with a different seed each time then reuse the same 
generator.

If you need to know the seed so it can be recorded and the experiment is 
repeatable then the overhead of creating a new generator will be insignificant 
against the total time of the experiment including recording the seed, even if 
the experiment has only a few operations based around the output of the random 
generator.


> 是否可以动态设置seed?
> -------------
>
>                 Key: RNG-161
>                 URL: https://issues.apache.org/jira/browse/RNG-161
>             Project: Commons RNG
>          Issue Type: Improvement
>          Components: client-api
>    Affects Versions: 1.3
>            Reporter: sun
>            Priority: Major
>
> Does Commons RNG can set the seed by method,isn't use 
> RandomSource.create,like random.setSeed() to set the seed ?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to