# Did Thanos kill me?

Some of you may have seen Avengers: Infinity War already, some may have not. Via Geek Girl Authority I found this website: www.didthanoskill.me/. There you can check whether you will survive the carnage at the end of the movie.

As is to be expected the decision process is not very sophisticated:

```if (randomNumber < 0.5) {
displayElement.textContent = "You were slain by Thanos,
for the good of the Universe.";
} else {
displayElement.textContent = "You were spared by Thanos.";
}
```

The script first retrieves a cookie:

```var randomNumber = getCookie("thanosNumber");
```

If that number exists it will be used in the decison process, so the random number is generated on your first visit and re-used on each next reload. My `thanosnumber’ is 0.3461087295578963, so I’m a goner.

I also checked whether the process is fair; it is on this page you can read that the random number is in the interval [0,1) (including 0, excluding 1). That means that, even accounting for the finite precision, half the numbers can be expected to be less than ½.

To see why excluding 1 mighyt matter think of a machine with a very low precision, say two binary digits. This means that the random numbers would be chosen from these four: .00, .01, .10, .11 (that is: 0, ¼, ½, ¾,). Clearly your probability of survival would be 2/4, i.e., one half. On the other hand, if 1 were als a possible outcome then your survival probability would be 3/5.

For the population of the Earth and with the precision suggested by my thanosnumber including 1 or not would not make much difference.
Since there are no more that 1010 people and the thanosnumbers have a precisioon of 16 digits the difference in the order of 10-6 person.

Be Sociable, Share!