# Zufallsgenerator mit Wahrscheinlichkeit

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

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:

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

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

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.