Hey guys I'm a python newbie and I decided to check my 2 month python skills by creating a small text-based decision game. I thought it would be nice to implement some RNG on that decision making. My initial thought was to create a list L=[] which will have 0 and 1s.Depending on the probability I want,I'd fix the 0/1 ratio.So, if I want a rng effect to take place in a specific moment with p=0.2, I'd simply have to make a list with a 0/1 ratio of 5:1 (assuming 1 is success , rng effect takes place) , then I'd use the random.choice() function and I'd have my result. But this got me thinking,what if i wanted a more specific percentage,say 16,77%? How do games actually implement RNG? I would assume they dont create a huge List with 1000 elements and do what I did.
Aucun commentaire:
Enregistrer un commentaire