Interface SeededVariableAmount<T>

Type Parameters:
T - The seed object type
All Known Implementing Classes:
SeededVariableAmount.WrappedVariableAmount
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SeededVariableAmount<T>
Represents a value which may vary depending on a seed object.
  • Method Details

    • fixed

      static <T> SeededVariableAmount<T> fixed(double value)
      Creates a new 'fixed' variable amount, calls to amount(java.util.Random, T) will always return the fixed value.
      Type Parameters:
      T - The seed object type
      Parameters:
      value - The fixed value
      Returns:
      A variable amount representation
    • wrapped

      static <T> SeededVariableAmount<T> wrapped(VariableAmount value)
      Creates a new variable amount wrapping the given VariableAmount, calls to amount(java.util.Random, T) will always return wrapped amounts value.
      Type Parameters:
      T - The seed object type
      Parameters:
      value - The wrapped variable amount
      Returns:
      A variable amount representation
    • amount

      double amount(Random rand, T seed)
      Gets an instance of the variable amount depending on the given random object and the seed object.
      Parameters:
      rand - The random object
      seed - The seed object
      Returns:
      The amount
    • flooredAmount

      default int flooredAmount(Random rand, T seed)
      Gets the amount as if from amount(Random, Object) but floored to the nearest integer equivalent.
      Parameters:
      rand - The random object
      seed - The seed object
      Returns:
      The floored amount