# Probability of Euromillions numbers

Some time ago I read in the news that a woman won Euromillion twice using an Excel in order to calculate the probability of previous draws. It was quite interesting so I decided to give it a try using a public API and Swift programming language.

First of all, the API that I called in order to fetch the draws is from Pronostigol and the URL to fetch all the tickets was:

https://www.pronostigol.es/api/euromillones/tickets?per_page=1500

After introducing the API, let’s see the Swift code that do the magic.

IMPORTANT INFORMATION

This is not a system to predict the next draw. It only shows the probability of the last 1500 draws. My intention with this code is just to see what numbers have been the most repeated ones in the past and it is not possible to predict the future results.

# Swift Playground

Here you are the code to fetch the data and perform some calculations in order to display the probability of each number taking into consideration a maximum of 1500 draws.

And this is the output today 1st October 2020.

# Let’s display some charts

It’s interesting to see that as Euromillions has 50 different numbers, computed probabilities are over and below 2.0. That makes sense as 50 multiplied by 2 is 100. So we can say without so much error that is a random draw.

We have a similar result, as we have 12 stars, then we have probabilities above and below 9 as we have 12 multiplied by 9 is 108 that is close to 100. For some reason, star 12 has a low probability. Comment why you think this is happening

# Conclusion

We have calculated probabilities for numbers in Euromillions taking into consideration last 1500 draws and we can conclude that unfortunately the draw can be considered as random in a very high percentage.

Are you going to try your luck? Let me know it in the comments below how it was!

--

--

## More from Francisco Navarro

iOS Software Engineer 🍎 — Fan of Domotics

Love podcasts or audiobooks? Learn on the go with our new app.

## Francisco Navarro

iOS Software Engineer 🍎 — Fan of Domotics