lundi 11 janvier 2016

Algorithm to check a percentage that never fails twice in a row

I'm trying to reproduce some behavior for a simulator of mine:

I have a percentage check at 70% that I want to be able to succeed multiple times in a row but can actually never fail twice in a row. An other rule is that the first check will always succeed at 50%. I'm not saying that randomly: this is based on live data I extracted from the behavior i'm trying to simulate.

I've tried searching the web for algorithm like that but had no luck. I guess I could try saving hits and misses and adjusting each turn's chance based on the previous hits and misses but I can't help but think this must fall into some existing random generation pattern.

How could I proceed with coding something like that without having to record and readjust the percentage on each check ?

Note: I'll be coding that in Java.




Aucun commentaire:

Enregistrer un commentaire