Archmage.MinMax
An inclusive range of numbers or durations, the type of a minmax field, for drawing random values.
Inherits: RefCounted
Properties
Section titled “Properties”var min: VariantThe lower bound, inclusive: an int, a float or an Archmage.Duration, as the element type of the field.
var max: VariantThe upper bound, inclusive, of the same type as min.
Methods
Section titled “Methods”from_json()
Section titled “from_json()”static func from_json(d: Variant, conv: Callable, e: Archmage.ParseError = null) -> Archmage.MinMaxReturns the range in d, a parsed JSON object, converting each bound with conv.call(value, e), which returns the zero value for null. For null, returns a range whose bounds are zero. For any other value that is not an object, returns the same range and records the type mismatch in e (see Archmage.ParseError.report_mismatch()). When conv records an error in e, returns null.
to_json()
Section titled “to_json()”func to_json() -> DictionaryReturns the range as a JSON object.
sample()
Section titled “sample()”func sample(rng: RandomNumberGenerator = null) -> VariantReturns a random value from min to max, both included, drawn uniformly with rng, or with the global random number generator, which seed() affects, when rng is null. An Archmage.Duration is drawn in whole milliseconds: the bounds are truncated to milliseconds, and every value returned is a whole number of milliseconds.