How would it work (randomizer) from 1-20

Asked Jul 24, 2020·4 replies·Last activity 6 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Since I have no clue of codeing...
Can someone make such an command?
Like i've said, just one that goes from 1-20... also can you make a name for every number?
Every number should have the same chance to win if you want so. (5% each)

Would be great if someone could help

4 replies

Are you looking to add a command that returns a response or a number when it’s called or both?

Yeah, basically that I get a random number between 1 and 20

And I have no i dont know if you can name every number something...
(thats just a side thing which would make it better)

Hey @Quiet Hippo!

For a random number between 1 and 20 inclusive use:

$(eval Math.floor(Math.random()*20)+1)

If you want to name every 20 outputs, it'd be easier to create an array and then pick something at random out of it:

$(eval a=[`ARRAY_ITEM_1`,`ARRAY_ITEM_2`,`ARRAY_ITEM_3`, ... ,`ARRAY_ITEM_20`];a[Math.floor(Math.random()*a.length)])

First of all, thanks a lot!
It worked just fine, It took a while to type as you can imagine...
But still thanks for your great Help!