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-76) Add a primitive constructor to SplitMix64
Date Fri, 01 Mar 2019 20:48:00 GMT
Alex D Herbert created RNG-76:

             Summary: Add a primitive constructor to SplitMix64
                 Key: RNG-76
             Project: Commons RNG
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.3
            Reporter: Alex D Herbert
            Assignee: Alex D Herbert

The constructor for {{SplitMix64}} uses a {{Long}} for the seed. If constructed using a primitive
{{long}} then auto-boxing will occur.

I added a {{long}} version of the constructor to SplitMix64:
SplitMix64(Long seed);
SplitMix64(long seed);
I modified the {{ConstructionPerformance}} benchmark to generate 5000 random seeds as {{Long}}
or {{long}} then tested:
// Pre-generated Long
new SplitMix64(Long seed);

// Pre-generated long that is boxed to Long
new SplitMix64(Long.valueOf(long seed));

// Pre-generated long
new SplitMix64(long seed);

Given that the {{SplitMix64}} is the preferred RNG for seeding from a single {{long}} value
it makes sense to add the constructor version that accepts a {{long}}.

This message was sent by Atlassian JIRA

View raw message