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.
Represents a value which may vary depending on a seed object.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classASeededVariableAmountwhich wraps anotherVariableAmountand defers all operations to the inner VariableAmount without the seed. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets an instance of the variable amount depending on the given random object and the seed object.static <T> SeededVariableAmount<T>fixed(double value) Creates a new 'fixed' variable amount, calls toamount(java.util.Random, T)will always return the fixed value.default intflooredAmount(Random rand, T seed) Gets the amount as if fromamount(Random, Object)but floored to the nearest integer equivalent.static <T> SeededVariableAmount<T>wrapped(VariableAmount value) Creates a new variable amount wrapping the givenVariableAmount, calls toamount(java.util.Random, T)will always return wrapped amounts value.
-
Method Details
-
fixed
Creates a new 'fixed' variable amount, calls toamount(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
Creates a new variable amount wrapping the givenVariableAmount, calls toamount(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
Gets an instance of the variable amount depending on the given random object and the seed object.- Parameters:
rand- The random objectseed- The seed object- Returns:
- The amount
-
flooredAmount
Gets the amount as if fromamount(Random, Object)but floored to the nearest integer equivalent.- Parameters:
rand- The random objectseed- The seed object- Returns:
- The floored amount
-