Ich bräuchte eine Random Math formel mit unterschiedlichen Wahrscheinlichkeiten.
1=1%
2=2%
3=20%
4=5%
5=4%
6=0,5%
7=0,5%
8=0,5%
9=1,5%
10=25%
11=25%
12=2,5%
13=2,5%
14=5%
15=0,5%
16=0,5%
17=4%

Es wäre einfach mega wen irgendwer eine Lösung für mich hätte

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`}else if(r<70){o=`responseIfBetween50And69Included`}else if(r<50){o=`responseIfBetween30And49Included`}else 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

ok didn´t know that you should write in english, sry. So I want out of the 17 numbers that each number has a probability. therfore every number has a % number. so yes, i would like the 17 to have 4% probability, for exampel, if i execute the command once. only becaus i have absolutely no idea how to write such a coomand did i ask her

Emily
April 17, 2022, 9:03am
#4
So what you can do is like the code in the second topic I linked:

`$(eval r=Math.floor(Math.random()*200)+1;o=1;if(r>2){o=2}else if(r>6){o=3}else if(r>46){o=4}else if(r>56){o=5}else if(r>64){o=6}else if(r>65){o=7}else if(r>66){o=8}else if(r>67){o=9}else if(r>70){o=10}else if(r>120){o=11}else if(r>170){o=12}else if(r>175){o=13}else if(r>180){o=14}else if(r>190){o=15}else if(r>191){o=16}else if(r>192){o=17}o;)`

thank you very much, thats helps a lot

1 Like

system
closed
May 1, 2022, 5:23pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.