Y
Y
Yura Mailler2020-12-14 09:03:55
Unity
Yura Mailler, 2020-12-14 09:03:55

How to make the chances of winning?

Hi all! How to make chances for Random, I need to be able to adjust the odds, let's say that the number 1 gives more often than the number 2

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
freeExec, 2020-12-14
@freeExec

var цифра = рандом() < 0.8 ? 1 : 2;

G
GavriKos, 2020-12-14
@GavriKos

There is such a thing - weight random.
Each item has a weight. When generating - the weights are summed up, a number is generated from 0 to the sum, and then we sequentially go through all the items, summing their weights, until the sum becomes more than the generated random number. On what item it happened - he fell out. The description is a little clumsy, but you can google "weight random".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question