Need help with random number generator command

Asked Aug 29, 2023·2 replies·Last activity 2 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.

I wrote a nightbot command from the information i could find, it should be a random number generator in between 200 and 278, but for some reason when i use the command in twitch the number sometimes ends up being over 400. heres the command
"$(user), You longjumped $(eval Math.floor(Math.random() * 287) + 200) units"
Help please

2 replies

Hi, if you need the range to be between 200 and 278 then it should be like this:

$(user), You longjumped $(eval Math.floor(Math.random() * 78) + 200) units

Thank you, Now I understand how it works 😅