Class LegacyRandomSeeder

    • Constructor Detail

      • LegacyRandomSeeder

        public LegacyRandomSeeder​(SeedGenerator seedGenerator,
                                  ThreadFactory threadFactory)
        Creates an instance whose thread will terminate if no PRNGs have been associated with it for 5 seconds.
        Parameters:
        seedGenerator - the seed generator
        threadFactory - the ThreadFactory that will create this seeder's thread
      • LegacyRandomSeeder

        public LegacyRandomSeeder​(SeedGenerator seedGenerator,
                                  ThreadFactory threadFactory,
                                  long stopIfEmptyForNanos)
        Creates an instance.
        Parameters:
        seedGenerator - the seed generator
        threadFactory - the ThreadFactory that will create this seeder's thread
        stopIfEmptyForNanos - time in nanoseconds after which this thread will terminate if no PRNGs are attached
    • Method Detail

      • initTransientFields

        protected void initTransientFields()
        Description copied from class: RandomSeeder
        Initializes the transient instance fields for this class. Called by constructors and during deserialization.
        Overrides:
        initTransientFields in class RandomSeeder
      • removeLegacyRandoms

        public void removeLegacyRandoms​(Random... randoms)
        Removes Random instances.
        Parameters:
        randoms - the instances to remove
      • addLegacyRandoms

        public void addLegacyRandoms​(Random... randoms)
        Adds Random instances.
        Parameters:
        randoms - the PRNGs to start reseeding
      • addLegacyRandoms

        public void addLegacyRandoms​(Collection<? extends Random> randoms)
        Adds Random instances.
        Parameters:
        randoms - the PRNGs to start reseeding
      • contains

        public boolean contains​(Object random)
        Description copied from class: RandomSeeder
        Checks whether the given PRNG is currently registered with this RandomSeeder.
        Overrides:
        contains in class RandomSeeder
        Parameters:
        random - the PRNG to check the status of
        Returns:
        true if registered; false if not
      • iterate

        protected boolean iterate()
        Description copied from class: Looper
        The task that will be iterated until it returns false. Cannot be abstract for serialization reasons, but must be overridden in subclasses if they are instantiated without a target Runnable.
        Overrides:
        iterate in class RandomSeeder
        Returns:
        true if this thread should iterate again.
      • isEmpty

        public boolean isEmpty()
        Description copied from class: RandomSeeder
        Returns true if no Random instances are registered with this LegacyRandomSeeder.
        Overrides:
        isEmpty in class RandomSeeder
        Returns:
        true if no Random instances are registered with this LegacyRandomSeeder.
      • clear

        protected void clear()
        Description copied from class: RandomSeeder
        Removes all PRNGs from this seeder.
        Overrides:
        clear in class RandomSeeder