-
Notifications
You must be signed in to change notification settings - Fork 1
randompicknumber
Daedalus1400 edited this page May 18, 2017
·
1 revision
The randompick generic picks randomly from a specified list. This page details usage for numbers.
Added in release version 0.4.0
Must be "randompick".
Accepts an array of either numbers or weighted numbers. Mixing is allowed. Weighted numbers are JSON Objects with the format
{"number": 20, "weight": 3}
Both arguments are required. Weights are relative to the other weights specified, so a weight of 2 will be picked twice as often as a weight of 1. Specifying three weighted numbers with weights 1, 2, and 3 would produce the same relative frequency as using weights 10, 20, and 30.
Literal numbers are given a weight of 1.
The following example applies nausea to the player for a random amount of time picked from 100, 200, and 300 ticks:
{"type": "potioneffect", "effect": "nausea", "duration": {"type": "randompick", "value": [{"number": 100, "weight": 3}, {"number": 200, "weight": 2}, 300]}}