Generate a Random number

Asked Oct 17, 2020Β·4 repliesΒ·Last activity 5 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.

Hi, I'm from Argentina .. I'm new to Nightbot and I want to generate a random number between two ranges of numbers. for example 1-10 and 50-60 ..

help me pls

4 replies

Heya, try this...

$(eval const r= ['$(eval Math.floor((Math.random() * 10) + 1))', '$(eval Math.floor((Math.random() * 10) + 51))']; r[Math.floor(Math.random() * r.length)];)

Well if you want any other use this

Math.floor((Math.random() * (max_num - min_num) + min_num + 1)

I hope it will work.. And please ignore my logic πŸ˜ΆπŸ˜…πŸ€«

Thanks for your answer!! but the command doesn't work ): , Nightbot says "Invalid or unexpected token" in chat

Ahh you know what.. That was not my fault.. Lemme explain.. If you type [ ; ) ] without space it will turn into [πŸ˜‰] this emote.. See at the last

Copy this... I hope this will work

$(eval const r= ['$(eval Math.floor((Math.random() * 10) + 1))', '$(eval Math.floor((Math.random() * (10)) + 51))']; r[Math.floor(Math.random() * r.length)]; )

it works now!! thank you thank you πŸ˜„ @Maple Goose