Emily
April 14, 2022, 5:52pm
2
Hey @Phoenixkeks !
We only offer support in English.
I don’t understand what you’re looking for, you have a table, but it’s impossible to know if you want the number 17 to have a 4% chance to show up, or if you want 17 different outputs, one of which being “4%,” I could guess, but it’s your job to be specific and explain clearly what you’re trying to achieve.
In the meantime, have a look at these topics:
Hey @imlightbringer !
It’s not too far off the other type of commands you might have seen.
As explained here , you can generate a number between two values — both included — like this:
Math.floor(Math.random() * (max - min + 1) ) + min;
With that in mind, here’s how you can write the command to fit your needs, and you just need to replace MIN_VALUE and MAX_VALUE by the numbers you want:
$(eval min = MIN_VALUE; max = MAX_VALUE; Math.floor(Math.random() * (max - min + 1)) + min;)
Hey @dirqf !
Here’s a solution:
$(eval r=Math.floor(Math.random()*100)+1;o=`responseIfAboveOrEqualTo90`;if(r<90){o=`responseIfBetween70And89Included`} if(r<70){o=`responseIfBetween50And69Included`} if(r<50){o=`responseIfBetween30And49Included`} if(r<30){o=`responseIfBellow30`}`$(user) is a cracker at ${r}%. ${o}.`)
Hey @willzanimationz !
So I thought about a solution to your command, since you didn’t give the percent chance of rolling a each number it gave me a lot of space to be creative!
My idea is to use Euler’s number, this way it gets increasingly harder to get selected numbers.
But then, after analyzing the results of my tests with your problematic in mind, turns out it would give me more 12 than 0, which I would have noticed before if I paid more attention to the ln(x) and e^(x) plots. It was the …
1 Like