#/random with multiple ranges?

1 messages · Page 1 of 1 (latest)

unborn quiver
#

I want to randomly generate numbers from multiple ranges; /random 1..3, 7..9 and it will give any of: 1,2,3,7,8,9
Only two ranges seems easy:
/store [...] random 1..2
if [...] 1 run random 1..3
if [...] 2 run random 7..9

Doing that for a very large amount of ranges is going to be really annoying though, is there a better way?

silk bayBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1723405096:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

vale cliff
#

You could use macros, but even then you'd need a command for each range you want all at once

pale vault
slow owlBOT
#
data modify storage main random_array set value [1,2,3,7,8,9]
execute store result storage main macros.i int 1 run random value 0..5
function get_number with storage main macros

function get_number

$execute store result score #random main_score run data get storage main random_array[$(i)]
unborn quiver
#

Thank you !