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

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

{quote}Couldn't it be used to produce the output required for the mix?
{quote}
In therory yes. But there may be a thread deadlock if using 
ThreadLocalRandomSource since it uses the SeedFactory to create new instances 
on each thread. So I am assuming the SeedFactory cannot use it:

ThreadLocalRandomSource -> uses SeedFactory when on a new thread

SeedFactory -> uses ThreadLocalRandomSource, which when on a new thread will 
use the SeedFactory

I might try this just to confirm. Otherwise it is very easy to have a 
ThreadLocal<> instead holding a SplitMix which would be seeded using an 
incrementing AtomicLong. I don't think it necessary to seed using anything more 
random. I'll review what ThreadLocalRandom and SplittableRandom do for new 
instances. They may mix the output from an incrementing long since the mix is 
cheap compared with the synchronised increment.

> SeedFactory seed creation performance analysis
> ----------------------------------------------
>
>                 Key: RNG-104
>                 URL: https://issues.apache.org/jira/browse/RNG-104
>             Project: Commons RNG
>          Issue Type: Task
>          Components: simple
>    Affects Versions: 1.3
>            Reporter: Alex D Herbert
>            Assignee: Alex D Herbert
>            Priority: Minor
>
> The SeedFactory is used to create seeds for the random generators. To ensure 
> thread safety this uses synchronized blocks around a single generator. The 
> current method only generates a single int or long per synchronisation. 
> Analyze the performance of this approach. The analysis will investigate 
> generating multiple values inside each synchronisation around the generator.
> This analysis will also investigate methods to supplement the SeedFactory 
> with fast methods to create seeds. This will use a fast seeding method to 
> generate a single long value. This can be a seed for a SplitMix generator 
> used to create a seed of any length.
>  



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

Reply via email to