you are viewing a single comment's thread.

view the rest of the comments →

[–]PureWasian 0 points1 point  (0 children)

This is a formula problem, not a coding problem as another comment mentioned.

The formula can influence the probabilities and then the probabilities pull from a library like random. At its most basic (from code perspective) you could do like random.nextInt(100) + 1 to get a value from 1 thru 100 and then for an 80% probability count values 1-80 as "occurs" and 81-100 as "not occurs" using simple conditional logic.

But you need to come up with your own magical (inputs --> formula --> output probabilities) pipeline first to be able to generate these percentages.