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

Alex D Herbert commented on RNG-57:
-----------------------------------

A post to the commons developers list mentioned a release for v1.2 with this as 
the last outstanding issue. I am not sure my reply to the mailing list is 
published so I repeat is here:

=== 
 The speed improvement has been demonstrated. However the effect on the 
randomness has not been tested using the 3rd party DieHarder and BigCrush test 
suites. I would be reluctant to change the core library without verifying the 
impact of the change.
  
 A second issue is that the change causes the current test suite to fail. As 
explained in this thread this is due to the high number of tests with a 1% 
acceptance level. Basically after enough tests for randomness something will 
almost certainly fail. The current test suite is expected to (and does) fail 
over 98% of the time with random seeds. It currently uses fixed seeds that work.
  
 Ideally the suite would work with random seeds and use a more selective set of 
tests (to reduce the chance for failures) but I have not had time to look at 
reengineering the test suite.

It may be better to delay this for a later release.
 === 
  
 Is there a guide for how to run DieHarder and BigCrush? I can do that with the 
changes and post the results. That should at least verify that the speed 
improvement has not broken the {{nextInt}} functionality of the 
{{LongProvider}}.

If the change is OK then work should be done to make the test suite more robust 
as outlined in comment [#16643062], e.g.:
  
 - Change to test each provider only once for the {{int}} or {{long}} source of 
randomness
 - Change to test the underlying implementation of the 
{{UniformRandomProvider}} interface once for the {{int}} or {{long}} random 
source
 

Once complete then this change can be put into a PR.
  

> CachedUniformRandomProvider for nextBoolean() and nextInt()
> -----------------------------------------------------------
>
>                 Key: RNG-57
>                 URL: https://issues.apache.org/jira/browse/RNG-57
>             Project: Commons RNG
>          Issue Type: Improvement
>          Components: core
>            Reporter: Alex D Herbert
>            Priority: Minor
>              Labels: performance
>             Fix For: 1.2
>
>
> Implement a wrapper around a {{UniformRandomProvider}} that can cache the 
> underlying source of random bytes for use in the methods {{nextBoolean()}} 
> and {{nextInt()}} (in the case of {{LongProvider}}). E.g.
> {code:java}
> LongProvider provider = RandomSource.create(RandomSource.SPLIT_MIX_64);
> CachedLongProvider rng = new CachedLongProvider(provider);
> // Uses cached nextLong() 64 times
> rng.nextBoolean();
> // Uses cached nextLong() twice
> rng.nextInt();
> IntProvider provider = RandomSource.create(RandomSource.KISS);
> CachedIntProvider rng2 = new CachedIntProvider(provider);
> // Uses cached nextInt() 32 times
> rng2.nextBoolean();
> // This could be wrapped by a factory method:
> UniformRandomProvider rng = CachedUniformRandomProviderFactory.wrap(
>         // Any supported source: IntProvider or LongProvider
>         RandomSource.create(RandomSource...));
> {code}
> The implementation should be speed tested to determine the benefit for 
> {{nextBoolean()}} and if {{nextInt()}} can be improved for {{LongProviders}}.



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

Reply via email to