Interface RandomSource

All Known Subinterfaces:
BitRandomSource
All Known Implementing Classes:
LegacyRandomSource, RandomSequences.DirtyMarkingRandomSource, SingleThreadedRandomSource, ThreadSafeLegacyRandomSource, WorldgenRandom, XoroshiroRandomSource

public interface RandomSource
A basic interface for random number generation. This mirrors the same methods in Random, however it does not make any guarantee that these are thread-safe, unlike Random. The notable difference is that setSeed(long) is not synchronized and should not be accessed from multiple threads. The documentation for each individual method can be assumed to be otherwise the same as the identically named method in Random.
See Also:
  • Random
  • invalid reference
    net.minecraft.world.level.levelgen.SimpleRandomSource
  • Field Details

  • Method Details

    • create

      static RandomSource create()
    • createThreadSafe

      @Deprecated static RandomSource createThreadSafe()
      Deprecated.
    • create

      static RandomSource create(long seed)
    • createNewThreadLocalInstance

      static RandomSource createNewThreadLocalInstance()
    • fork

      RandomSource fork()
    • forkPositional

      PositionalRandomFactory forkPositional()
    • setSeed

      void setSeed(long seed)
    • nextInt

      int nextInt()
    • nextInt

      int nextInt(int bound)
    • nextIntBetweenInclusive

      default int nextIntBetweenInclusive(int min, int max)
    • nextLong

      long nextLong()
    • nextBoolean

      boolean nextBoolean()
    • nextFloat

      float nextFloat()
    • nextDouble

      double nextDouble()
    • nextGaussian

      double nextGaussian()
    • triangle

      default double triangle(double center, double maxDeviation)
    • consumeCount

      default void consumeCount(int count)
    • nextInt

      default int nextInt(int origin, int bound)