commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex D Herbert (JIRA)" <>
Subject [jira] [Created] (RNG-57) CachedUniformRandomProvider for nextBoolean() and nextInt()
Date Mon, 24 Sep 2018 13:49:00 GMT
Alex D Herbert created RNG-57:

             Summary: CachedUniformRandomProvider for nextBoolean() and nextInt()
                 Key: RNG-57
             Project: Commons RNG
          Issue Type: Improvement
          Components: sampling
    Affects Versions: 1.2
            Reporter: Alex D Herbert

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.
LongProvider provider = RandomSource.create(RandomSource.SPLIT_MIX_64);
CachedLongProvider rng = new CachedLongProvider(provider);
// Uses cached nextLong() 64 times
// Uses cached nextLong() twice

IntProvider provider = RandomSource.create(RandomSource.KISS);
CachedIntProvider rng2 = new CachedIntProvider(provider);
// Uses cached nextInt() 32 times

// This could be wrapped by a factory method:
UniformRandomProvider rng = CachedUniformRandomProviderFactory.wrap(
        // Any supported source: IntProvider or LongProvider
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

View raw message