java.lang.Object
org.cloudburstmc.server.level.generator.standard.misc.IntRange

public final class IntRange extends Object
Represents a numerical range.

Note that max is always an exclusive bound.

Author:
DaPorkchop_
  • Field Details

    • EMPTY_RANGE

      public static final IntRange EMPTY_RANGE
    • ONE

      public static final IntRange ONE
    • WHOLE_WORLD

      public static final IntRange WHOLE_WORLD
    • min

      public final int min
    • max

      public final int max
    • gaussian

      public final boolean gaussian
    • downwardBias

      public final boolean downwardBias
  • Constructor Details

    • IntRange

      public IntRange(int min, int max)
    • IntRange

      public IntRange(int min, int max, boolean gaussian, boolean downwardBias)
    • IntRange

      public IntRange(String value)
    • IntRange

      public IntRange(int value)
  • Method Details

    • rand

      public int rand(@NonNull @NonNull net.daporkchop.lib.random.PRandom random)
      Gets a random value within this IntRange.
      Parameters:
      random - an instance of PRandom to use for generating random numbers
      Returns:
      a random value within this IntRange
    • empty

      public boolean empty()
      Returns:
      whether or not this IntRange is empty
    • size

      public int size()
      Returns:
      the size of this IntRange
    • contains

      public boolean contains(int value)
      Whether or not the given value is included in this range.
      Parameters:
      value - the value to check
      Returns:
      whether or not this range contains the givenv alue
    • toString

      public String toString()
      Overrides:
      toString in class Object