How does randomness work under the hood?

Started by Boba Phat, November 21, 2016, 09:08:37 AM

Previous topic - Next topic

Boba Phat

I have three colonists with a probability of taming a group of three elephants of between 7% and 8% each, and the chance of them turning mankiller 2.5%.  Supposedly.  Over the course of 14 days, I had zero successful tames, and four mankiller failures.  This seemed wonky, so I plugged the numbers into an online chi square calculator, and unless I made a mistake the chances of this occurring purely through randomness are virtually zero.  Is there something going on under the hood I don't understand?  Or have I made a mistake in working the chi square?  I save-scummed after each critical failure (since a mankiller pack of elephants would essentially be a game-over for me); does this mean the game secretly tracks successes and failures and ensures you'll always have a statistical balance of results to deter save-scumming?

Bozobub

#1
You're WAY overthinking the problem, I believe; this is NOT a chi-square problem at all :o.  The probability of a tame attempt failing, then having the animal turn mankiller, is % chance of tame failure multiplied by % chance of enraging the animal.  The only thing that's happening here, is that successes are removed from consideration (they never turn into mankillers, of course).

So the chance for a given tame attempt to result in a mankiller is (for your 7% tame success chance and 2.5% mankiller example) .93*.025, or about 2.3%.  That's not "near zero", really.

Now, if you want the overall probability that you'll see a mankiller out of all three attempts taken together, that's a bit different but doesn't seem to be what you're asking ^^' .

Remember, also, that the game scenario director (Phoebe, Cassandra, or Randy) strongly affects many events, although I don't know if that includes mad animals from failed taming, rather than simple "mad animal" random attacks.
Thanks, belgord!

Zhentar

Assuming you had two tame attempts for each of three elephants per day, over 14 days, for a total of 84 trials, you'd have a 0.14% chance of zero successful tames. However, "virtually zero", this is not. That's a 1 in 715 chance. Out of the 4,300 players playing RimWorld on Steam at this instance, we should expect at least 6 of them to have "luck" at taming at least as bad as yours. And over the course of 84 failed trials, there is a 72% chance of at least one manhunter event, so encountering several of them is not particularly unusual.

As far as actual technical details, RimWorld uses xxHash seeded with the current time when RimWorld first launches, and incremented every time a random number is needed. There are certain cases where a different seed & iteration count is used, to get consistent results across calls/sessions for certain evaluations, but taming is not one of those cases.