Class ReseedingThreadLocalRandomWrapper<T extends BaseRandom>

    • Constructor Detail

      • ReseedingThreadLocalRandomWrapper

        public ReseedingThreadLocalRandomWrapper​(SerializableSupplier<? extends T> initializer,
                                                 RandomSeeder randomSeederThread)
        Wraps the given SerializableSupplier. Uses the given RandomSeeder to reseed PRNGs, but not to initialize them unless the SerializableSupplier does so. This PRNG will be serializable if the SerializableSupplier's captures are serializable.
        Parameters:
        initializer - a supplier that will be called to provide the initial BaseRandom for each thread
        randomSeederThread - a random seeder that will reseed the PRNG for each thread when necessary
      • ReseedingThreadLocalRandomWrapper

        public ReseedingThreadLocalRandomWrapper​(int seedSize,
                                                 SeedGenerator seedGenerator,
                                                 SerializableFunction<byte[],​? extends T> creator)
                                          throws SeedException
        Wraps a seed generator and a function that takes a seed byte array as input. This ReseedingThreadLocalRandomWrapper will be serializable if the SerializableFunction's captures are serializable.
        Parameters:
        seedSize - the size of seed arrays to generate.
        seedGenerator - The seed generation strategy that will provide the seed value for each thread's BaseRandom, both at initialization and through the corresponding RandomSeeder.
        creator - a SerializableFunction that creates a BaseRandom from each seed. Probably a constructor reference.
        Throws:
        SeedException - if seedGenerator fails to generate an initial seed