Script for random variables

Trying to figure out how I can script a variable to randomly select between a set group of numbers, out of sequence.
EG: 155 to 157 AND 171-174
EG: 181, ,189, 193, 194, etc.

1692606764841.png
Control Variables -> Script:
JavaScript:
var list = [181, 189, 193, 194]; list[Math.randomInt(list.length)]
Control Variables -> Script:
JavaScript:
var list = [181, 189, 193, 194]; list[Math.randomInt(list.length)]
thank you! I l looked at the MV/MZ js help file but couldn't figure it out on the table! :ptea:
You're welcome! 👋

Alternatively, if it's just two big ranges split by a fixed amount, you can roll a single range then add a "gap" based on whether the rolled value is high enough, e.g.

◆Comment:Ranges: 155~157, 171~174. : :Starts at 155, total range of 7 (inclusive). ◆Control Variables:#0001 Temp = Random 155..161 ◆If:Temp > 157 ◆Comment:If after first sub-range, +13 (171 - 158) to move to second sub-range. ◆Control Variables:#0001 Temp += 13 ◆ :End ◆Text:None, Window, Bottom : :Selected \v[1]
So: 155~157 -> no change; 158~161 -> 171~174. Just have to be careful with the numbers.

Original thread: https://forums.rpgmakerweb.com/threads/script-for-random-variables.160480/