This example is a little program to generate random numbers based on historic lotto results. Each potential result pull is weighted based on past results. The full project is available on GitHub here. https://youtu.be/T_f01uwnN-A First, we need to store the historic data. In this case I use an instance of SortedDictionary. int totalBallsNeeded = 6; // 5 plus the extra shot int doubleBallCount = 104; // 52 numbers times 2 SortedDictionary<int, int> lottoNumberFrequencyTable = new SortedDictionary<int, int>(); lottoNumberFrequencyTable.Add(1, 29); lottoNumberFrequencyTable.Add(2, 34); // Add more entries as needed lottoNumberFrequencyTable.Add(52, 38); There is a possible range of 01 to 52 lotto values. I pulled the frequency data from online sources. In this case the key is the lotto number and the value is the frequency. After the data is stored, we do the actual random number generation with weighted frequency. The array we link our random numbers to is twice as large as...
Computers, programming, software development, AI, design, and more!