In Cuba there are problems or situations of all kinds, although there is no official lottery, in some places there are people (or families) who like to create their own mini-lottery, thus maintaining a family game that is sometimes won, and others not.
In every country in the world there is a lottery, or rather, lotteries, of all types and forms, for example in Spain you can play the lottery online at theLotter , or by buying tickets (are they called that?) in some square or street.
Well, in the family we want to play this ... how to do it in a way that is as "serious" as possible? We have several options:
- ExpertLotto : Software that connects to lotteries or allows you to create your own from scratch
- Bash : Through some simple commands we can generate random numbers, which do not repeat themselves, and use them as lottery numbers
Expert Lotto
This is an application for those who like lottery, it has many options, as well as it supports different types of lotteries: Jackpot, Keno, Powerball, Pick 3, Pick 4, Pick X… etc.
It allows us to manage the numbers that have previously come out, in this way they are not repeated too often if that is what we want, see statistics, filters, and much more.
If you don't want to create a new lottery, but simply connect to an existing one and track statistics, the following screen will appear when you open the software. I haven't been able to test this option due to geographical limitations, but I imagine it will work fine. This way you can play Fantasy 5 without leaving home, play the Mega Millions lottery online (which is supported), and much more.
To install ExpertLotto you must first download it, it is a .sh file that is downloaded and executed:
Generate our numbers with Bash
Another option is to simply generate our numbers, we must take into account the following:
- Number of numbers to "draw" (we will use in the example: 15)
- Total rows (we will use in the example: 5)
- The number of numbers must be divisible by the number of rows, that is, it must give a whole number
- Range in which the numbers will be (we will use in the example: between 1 and 100)
I clarify that the division of the total number of numbers between the number of rows must give an integer because then, if not, we would have (for example) 3 rows with 6 numbers and then the 4th row with only 3, come on, something silly 
To generate random numbers we will use the shuf command , to separate the numbers into rows we will use xargs
shuf -i 1-100 -n15 | xargs -n5
Hey there the magic command
- -i 1-100 - »We indicate the range of the numbers, in this case between 1 and 100
- -n15 - »Number of numbers to display
- | xargs -n5 - »The output or result of the previous command, organize it in rows of 5 numbers each
And that's it, nothing more to add... isn't bash wonderful? 😉 Now all that's left is to find some command or script that can guess the Mega Millions numbers or some other lottery... that way, I'll sell them, make a fortune, and my multi-millionaire life would be epic LOL!
The end!
Well, nothing more to add, there are other variants of the previous command (for example, using if or cycles), but ... this is the smallest that I could achieve.
I hope you find it useful, the next post that talks about this will bring a script that will make us all millionaires haha.