Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Number pick generate for Canada Lotto Max
const pastWinners = [
[2, 3, 4, 8, 9, 20, 30],
[10, 15, 16, 17, 19, 27, 38],
[18, 31, 38, 45, 46, 47, 48],
[8, 9, 12, 20, 22, 27, 30],
[25, 28, 31, 36, 42, 44, 49],
[3, 9, 15, 16, 19, 45, 48],
[1, 3, 5, 10, 16, 27, 43],
[3, 12, 21, 34, 37, 38, 41],
[2, 4, 18, 19, 20, 39, 44],
[3, 5, 7, 11, 13, 20, 29],
[12, 17, 22, 27, 28, 29, 35],
[2, 9, 18, 33, 36, 40, 49],
[9, 11, 23, 33, 35, 36, 42],
[8, 11, 14, 17, 26, 30, 36],
[6, 8, 12, 19, 20, 25, 49],
[1, 4, 5, 22, 25, 32, 34],
[1, 11, 20, 32, 41, 42, 44],
[3, 5, 17, 23, 28, 43, 46],
[3, 10, 16, 28, 31, 38, 47],
[18, 23, 28, 37, 44, 45, 47],
[12, 25, 27, 29, 34, 44, 45],
[2, 11, 17, 18, 22, 25, 39],
[7, 10, 13, 19, 24, 31, 41],
[4, 13, 23, 30, 31, 37, 43],
[11, 22, 28, 33, 39, 43, 47],
[1, 11, 15, 16, 20, 29, 39],
[8, 9, 11, 17, 37, 39, 41],
[6, 14, 16, 22, 30, 42, 45],
[1, 8, 9, 22, 29, 30, 32],
[7, 18, 29, 30, 41, 45, 46],
[1, 12, 18, 19, 21, 24, 41],
[7, 12, 15, 23, 35, 43, 49],
[13, 24, 29, 31, 35, 36, 42],
[13, 18, 20, 26, 32, 35, 47],
[7, 25, 26, 28, 32, 36, 37],
[13, 17, 24, 32, 33, 44, 45],
[5, 14, 22, 23, 35, 40, 49],
[6, 19, 24, 25, 36, 37, 39],
[3, 8, 9, 24, 28, 31, 44],
[7, 8, 13, 19, 23, 32, 40],
[9, 18, 25, 30, 39, 40, 43],
[1, 8, 16, 19, 26, 34, 41],
[1, 3, 13, 15, 28, 36, 49],
[22, 23, 26, 35, 37, 39, 47],
[13, 16, 19, 21, 24, 26, 30],
[8, 14, 17, 27, 28, 30, 48],
[1, 17, 31, 33, 39, 46, 49],
[26, 28, 33, 38, 42, 43, 47],
[5, 11, 20, 22, 35, 38, 46],
[3, 15, 22, 23, 33, 47, 49],
[5, 12, 18, 26, 29, 31, 37],
[16, 17, 18, 20, 40, 42, 43],
[1, 14, 15, 16, 24, 39, 49],
[1, 4, 12, 27, 35, 38, 46],
[8, 14, 16, 17, 18, 34, 41],
[10, 17, 25, 27, 29, 34, 38],
[1, 6, 14, 23, 38, 40, 47],
[2, 10, 37, 38, 39, 43, 47],
[15, 20, 24, 30, 39, 44, 46],
[1, 2, 15, 16, 22, 29, 41],
[1, 7, 18, 28, 31, 39, 48],
[18, 19, 23, 34, 39, 43, 46],
[2, 9, 13, 16, 25, 26, 45],
[13, 14, 19, 26, 27, 36, 37],
[1, 4, 11, 17, 27, 36, 37],
[9, 12, 16, 24, 33, 45, 47],
[2, 11, 12, 25, 33, 39, 44],
[2, 4, 11, 17, 26, 41, 42],
[4, 8, 13, 16, 26, 33, 38],
[7, 24, 26, 36, 37, 43, 44],
[2, 3, 6, 22, 24, 42, 46],
[1, 5, 20, 33, 34, 41, 42],
[7, 11, 20, 21, 22, 37, 47],
[11, 12, 25, 28, 33, 41, 43],
[14, 16, 18, 21, 38, 44, 49],
[8, 11, 18, 25, 34, 35, 38],
[11, 25, 26, 28, 38, 44, 45],
[11, 14, 20, 22, 26, 35, 43],
[10, 14, 22, 36, 38, 44, 45],
[3, 4, 13, 16, 35, 47, 49],
[23, 25, 29, 30, 42, 44, 45],
[8, 12, 14, 34, 37, 44, 48],
[1, 2, 12, 15, 22, 25, 41],
[16, 19, 21, 32, 37, 39, 45],
[2, 5, 6, 7, 8, 33, 45],
[1, 11, 15, 20, 36, 41, 47],
[3, 7, 20, 25, 29, 31, 44],
[1, 17, 19, 23, 28, 29, 47],
[5, 9, 14, 24, 33, 37, 46],
[11, 16, 19, 22, 24, 38, 41],
[8, 19, 24, 28, 34, 42, 48],
[1, 3, 8, 22, 29, 38, 47],
[4, 10, 21, 28, 29, 37, 45],
[2, 8, 24, 30, 31, 38, 40],
[10, 13, 18, 19, 38, 47, 48],
[5, 10, 14, 19, 31, 33, 47],
[1, 5, 11, 26, 28, 30, 41],
[2, 9, 27, 32, 38, 39, 43],
[11, 17, 24, 26, 34, 35, 39],
[5, 8, 20, 21, 29, 40, 47],
[2, 11, 20, 22, 31, 35, 47],
[7, 10, 21, 24, 38, 40, 49],
[8, 14, 18, 20, 24, 39, 46],
[4, 23, 29, 36, 39, 44, 46],
[3, 5, 19, 29, 33, 34, 44],
[33, 34, 36, 42, 44, 45, 47],
[14, 18, 22, 25, 36, 39, 44],
[8, 9, 12, 24, 29, 36, 37],
[4, 12, 17, 21, 32, 38, 42],
[3, 13, 24, 36, 39, 44, 45],
[7, 12, 14, 15, 27, 34, 44],
[4, 10, 11, 27, 29, 32, 41],
[1, 12, 15, 22, 25, 45, 48],
[3, 10, 17, 19, 26, 27, 42],
[19, 22, 25, 32, 37, 45, 47],
[5, 7, 15, 18, 19, 27, 28],
[4, 6, 10, 20, 40, 46, 47],
[11, 15, 25, 26, 39, 47, 49],
[9, 26, 28, 32, 37, 40, 45],
[19, 30, 31, 36, 40, 44, 49],
[1, 8, 16, 25, 30, 42, 48],
[10, 12, 14, 28, 36, 39, 45],
[2, 17, 22, 24, 26, 42, 48],
[1, 16, 20, 29, 33, 44, 46],
[5, 11, 15, 26, 27, 33, 39],
[12, 21, 28, 37, 40, 43, 47],
[1, 14, 16, 20, 26, 32, 34],
[16, 17, 19, 22, 31, 47, 49],
[3, 6, 8, 17, 21, 28, 34],
[1, 8, 10, 24, 26, 37, 45],
[11, 21, 22, 24, 26, 36, 43],
[13, 16, 20, 35, 37, 43, 49],
[1, 9, 17, 19, 25, 27, 38],
[9, 12, 13, 14, 28, 39, 41],
[5, 6, 27, 28, 31, 41, 45],
[1, 6, 15, 32, 42, 45, 46],
[6, 8, 15, 24, 26, 39, 44],
[9, 17, 27, 30, 31, 34, 42],
[4, 14, 24, 41, 42, 44, 48],
[6, 9, 22, 23, 36, 38, 47],
[2, 11, 20, 22, 33, 40, 43],
[19, 20, 26, 31, 34, 39, 48],
[6, 7, 8, 9, 17, 23, 30],
[5, 11, 14, 17, 28, 41, 47],
[20, 21, 22, 34, 42, 43, 45],
[7, 26, 27, 31, 32, 33, 42],
[13, 15, 21, 24, 25, 36, 48],
[6, 10, 13, 14, 25, 41, 46],
[5, 8, 9, 12, 22, 39, 45],
[6, 20, 28, 29, 30, 31, 46],
[7, 12, 28, 34, 45, 46, 48],
[8, 15, 24, 25, 27, 36, 43],
[4, 8, 9, 20, 23, 45, 46],
[12, 21, 28, 34, 36, 45, 48],
[7, 11, 19, 38, 40, 41, 42],
[1, 10, 12, 20, 29, 35, 47],
[2, 11, 19, 38, 43, 45, 49],
[2, 7, 12, 28, 29, 38, 48],
[9, 14, 19, 21, 31, 32, 40],
[8, 11, 14, 23, 26, 42, 47],
[10, 12, 24, 26, 34, 43, 47],
[1, 7, 15, 18, 21, 30, 45],
[13, 16, 17, 21, 35, 40, 46],
[21, 22, 27, 30, 39, 42, 44],
[7, 8, 15, 19, 36, 37, 41],
[2, 4, 5, 17, 29, 39, 41],
[3, 13, 15, 22, 33, 41, 49],
[1, 15, 17, 25, 34, 40, 41],
[5, 13, 20, 37, 39, 40, 41],
[2, 5, 27, 32, 35, 42, 46],
[2, 4, 11, 19, 28, 29, 38],
[23, 24, 29, 36, 42, 43, 49],
[12, 14, 23, 25, 31, 38, 40],
[1, 6, 30, 40, 46, 47, 49],
[2, 4, 16, 23, 30, 32, 46],
[7, 14, 15, 16, 21, 30, 41],
[4, 7, 11, 19, 34, 38, 48],
[2, 10, 13, 16, 30, 33, 48],
[1, 30, 38, 39, 44, 45, 47],
[1, 4, 21, 24, 29, 30, 46],
[16, 23, 24, 25, 40, 46, 47],
[1, 7, 17, 27, 32, 44, 48],
[6, 18, 20, 37, 40, 44, 46],
[3, 37, 38, 40, 42, 43, 46],
[7, 11, 14, 15, 19, 30, 41],
[7, 8, 16, 18, 24, 25, 46],
[10, 11, 23, 28, 32, 34, 41],
[3, 7, 15, 23, 29, 31, 45],
[7, 10, 16, 35, 36, 42, 45],
[2, 8, 10, 15, 17, 20, 24],
[2, 8, 9, 10, 24, 26, 41],
[4, 12, 16, 27, 37, 39, 44],
[26, 34, 38, 41, 46, 48, 49],
[6, 9, 18, 22, 25, 32, 44],
[1, 5, 7, 13, 14, 33, 46],
[10, 15, 21, 28, 32, 36, 37],
[1, 14, 15, 18, 26, 42, 48],
[6, 29, 30, 31, 36, 42, 45],
[3, 7, 12, 18, 31, 33, 35],
[8, 9, 14, 19, 28, 31, 46],
[15, 20, 29, 39, 40, 43, 46],
[3, 6, 13, 17, 22, 25, 43],
[2, 14, 30, 34, 38, 47, 48],
[10, 14, 15, 16, 42, 45, 48],
[3, 4, 7, 12, 17, 26, 34],
[6, 18, 19, 26, 37, 39, 47],
[2, 5, 7, 13, 15, 30, 38],
[1, 3, 6, 8, 14, 20, 30],
[3, 12, 25, 30, 42, 44, 45],
[8, 27, 30, 32, 34, 35, 42],
[18, 19, 32, 36, 38, 40, 43],
[5, 13, 18, 28, 31, 38, 44],
[7, 15, 24, 25, 27, 43, 47],
[2, 3, 5, 18, 37, 38, 46],
[5, 6, 8, 13, 24, 37, 46],
[3, 8, 11, 20, 28, 36, 38],
[1, 23, 26, 33, 35, 38, 42],
[13, 16, 22, 26, 35, 36, 39],
[9, 16, 17, 27, 32, 38, 47],
[6, 9, 16, 19, 20, 24, 30],
[1, 2, 5, 10, 11, 25, 34],
[7, 9, 24, 30, 35, 42, 43],
[1, 3, 16, 33, 34, 40, 42],
[1, 6, 10, 16, 18, 21, 31],
[5, 10, 11, 20, 26, 38, 46],
[4, 6, 7, 16, 18, 40, 46],
[12, 17, 32, 36, 43, 44, 49],
[12, 16, 24, 29, 36, 40, 47],
[3, 5, 17, 30, 36, 47, 49],
[2, 5, 10, 11, 23, 25, 31],
[3, 11, 16, 24, 31, 39, 43],
[12, 13, 16, 30, 32, 35, 37],
[5, 7, 29, 35, 39, 41, 49],
[6, 15, 18, 19, 25, 44, 46],
[3, 9, 24, 25, 28, 36, 40],
[9, 16, 24, 30, 39, 40, 45],
[1, 3, 14, 33, 35, 39, 45],
[19, 30, 33, 34, 36, 41, 48],
[8, 15, 16, 21, 31, 37, 39],
[1, 2, 4, 21, 23, 35, 40],
[3, 4, 5, 7, 31, 33, 40],
[1, 6, 7, 16, 22, 31, 33],
[4, 7, 20, 22, 26, 28, 29],
[1, 10, 16, 23, 29, 35, 39],
[6, 8, 11, 16, 17, 19, 24],
[13, 19, 37, 38, 40, 43, 48],
[6, 10, 16, 27, 38, 40, 45],
[7, 10, 15, 23, 30, 36, 44],
[4, 9, 18, 32, 35, 38, 40],
[12, 28, 31, 38, 40, 41, 45],
[7, 16, 31, 35, 39, 44, 48],
[1, 6, 9, 11, 17, 37, 39],
[2, 13, 18, 24, 27, 37, 43],
[6, 16, 24, 32, 36, 45, 47],
[3, 4, 11, 18, 37, 42, 44],
[3, 6, 19, 31, 34, 42, 45],
[2, 24, 35, 38, 39, 41, 48],
[1, 3, 10, 15, 25, 28, 31],
[7, 8, 10, 15, 24, 26, 41],
[11, 12, 16, 22, 30, 32, 49],
[13, 16, 24, 29, 33, 40, 49],
[10, 26, 28, 33, 34, 35, 40],
[7, 8, 9, 16, 21, 28, 48],
[12, 16, 19, 20, 28, 34, 42],
[10, 11, 18, 24, 26, 42, 47],
[2, 14, 15, 24, 40, 43, 44],
[2, 6, 12, 15, 16, 22, 49],
[1, 7, 23, 36, 37, 39, 41],
[6, 19, 20, 25, 31, 35, 36],
[5, 6, 10, 17, 22, 36, 48],
[2, 6, 20, 22, 30, 34, 49],
[6, 15, 19, 26, 43, 44, 49],
[2, 9, 23, 29, 30, 34, 43],
[5, 9, 12, 18, 24, 35, 42],
[3, 17, 19, 20, 34, 35, 43],
[14, 16, 17, 36, 45, 46, 48],
[5, 12, 15, 39, 44, 46, 49],
[2, 7, 15, 38, 43, 44, 47],
[2, 9, 12, 13, 27, 28, 36],
[2, 12, 15, 18, 21, 22, 25],
[5, 19, 24, 34, 35, 38, 43],
[5, 7, 10, 15, 22, 45, 47],
[9, 19, 21, 24, 39, 43, 48],
[8, 18, 21, 27, 33, 46, 49],
[3, 10, 19, 21, 27, 35, 36],
[4, 6, 21, 26, 30, 34, 35],
[10, 13, 15, 18, 25, 36, 47],
[2, 3, 8, 20, 28, 31, 34],
[3, 6, 37, 40, 42, 44, 48],
[2, 14, 15, 17, 24, 38, 40],
[8, 11, 12, 13, 22, 33, 47],
[7, 12, 16, 19, 21, 24, 47],
[9, 16, 17, 19, 22, 41, 43],
[9, 15, 17, 28, 35, 39, 41],
[1, 2, 5, 6, 38, 39, 46],
[5, 12, 24, 31, 39, 45, 49],
[14, 23, 24, 25, 28, 41, 45],
[3, 8, 13, 30, 38, 45, 47],
[5, 9, 10, 32, 37, 44, 46],
[1, 18, 19, 29, 31, 32, 46],
[5, 11, 22, 29, 38, 42, 49],
[3, 10, 13, 23, 31, 41, 45],
[6, 8, 10, 17, 28, 29, 38],
[1, 5, 9, 19, 27, 35, 48],
[8, 9, 11, 22, 24, 42, 46],
[1, 2, 5, 26, 29, 36, 47],
[3, 4, 20, 25, 30, 35, 48],
[1, 2, 3, 15, 22, 37, 41],
[5, 7, 12, 15, 35, 45, 47],
[1, 12, 23, 27, 30, 31, 37],
[5, 6, 32, 33, 39, 42, 47],
[7, 8, 10, 11, 19, 34, 45],
[2, 27, 30, 31, 37, 46, 47],
[11, 14, 18, 20, 37, 41, 46],
[5, 12, 13, 28, 33, 37, 43],
[2, 3, 5, 22, 23, 32, 33],
[18, 19, 22, 27, 29, 36, 47],
[2, 15, 18, 19, 22, 27, 49],
[1, 2, 18, 26, 27, 39, 42],
[2, 20, 25, 26, 46, 47, 48],
[4, 7, 29, 35, 39, 43, 44],
[3, 13, 14, 23, 33, 36, 45],
[14, 26, 31, 34, 37, 45, 48],
[10, 14, 20, 28, 35, 40, 42],
[1, 12, 20, 22, 30, 34, 38],
[8, 11, 20, 28, 36, 43, 47],
[9, 10, 16, 24, 26, 44, 48],
[4, 7, 13, 24, 26, 27, 43],
[1, 2, 3, 6, 12, 20, 41],
[3, 4, 13, 15, 21, 29, 48],
[1, 6, 7, 24, 31, 36, 39],
[3, 5, 6, 25, 37, 43, 45],
[3, 23, 28, 40, 42, 43, 45],
[14, 15, 16, 19, 30, 36, 46],
[2, 6, 11, 12, 16, 39, 45],
[15, 18, 19, 25, 32, 42, 49],
[3, 11, 12, 19, 35, 45, 47],
[6, 18, 21, 23, 24, 32, 48],
[5, 7, 18, 24, 28, 41, 49],
[7, 18, 19, 29, 39, 47, 48],
[4, 13, 14, 15, 34, 46, 47],
[6, 17, 23, 24, 25, 31, 38],
[1, 15, 26, 28, 31, 39, 49],
[1, 5, 25, 35, 38, 44, 47],
[2, 8, 12, 14, 33, 37, 47],
[8, 24, 28, 34, 37, 43, 45],
[9, 15, 21, 23, 41, 43, 44],
[6, 15, 18, 26, 41, 46, 48],
[1, 2, 8, 13, 22, 45, 46],
[2, 13, 22, 28, 35, 41, 42],
[3, 4, 9, 25, 26, 37, 39],
[11, 24, 26, 31, 42, 44, 46],
[3, 11, 18, 19, 23, 27, 44],
[23, 29, 33, 34, 39, 44, 48],
[8, 10, 15, 24, 30, 35, 49],
[8, 17, 27, 28, 39, 44, 49],
[5, 7, 9, 25, 31, 37, 39],
[5, 8, 13, 15, 27, 28, 37],
[2, 4, 18, 20, 29, 38, 41],
[6, 23, 27, 30, 34, 38, 45],
[1, 3, 7, 19, 31, 39, 49],
[12, 13, 24, 25, 26, 41, 43],
[5, 6, 7, 12, 14, 18, 25],
[8, 16, 24, 27, 30, 38, 40],
[12, 18, 22, 24, 28, 43, 49],
[6, 8, 15, 20, 30, 32, 42],
[2, 3, 8, 13, 18, 20, 23],
[6, 11, 12, 14, 35, 43, 44],
[4, 14, 24, 41, 43, 46, 49],
[4, 15, 21, 30, 33, 35, 47],
[11, 17, 18, 20, 22, 29, 45],
[1, 2, 3, 17, 24, 35, 36],
[4, 13, 23, 28, 32, 40, 42],
[3, 7, 8, 12, 18, 24, 41],
[17, 22, 28, 38, 41, 43, 45],
[15, 18, 20, 28, 29, 40, 47],
[2, 9, 10, 15, 29, 44, 48],
[2, 7, 14, 16, 22, 27, 47],
[8, 11, 12, 25, 28, 30, 33],
[8, 21, 28, 32, 33, 34, 48],
[5, 9, 19, 20, 21, 28, 30],
[7, 12, 14, 18, 30, 45, 47],
[7, 8, 14, 32, 38, 42, 44],
[6, 19, 24, 25, 26, 35, 36],
[1, 13, 20, 24, 39, 45, 47],
[7, 19, 34, 35, 38, 42, 46],
[3, 12, 14, 15, 25, 32, 49],
[13, 18, 25, 41, 44, 48, 49],
[5, 6, 11, 12, 24, 26, 34],
[1, 4, 22, 25, 26, 36, 46],
[2, 5, 10, 21, 25, 35, 49],
[2, 3, 4, 20, 22, 40, 43],
[3, 18, 27, 29, 32, 33, 35],
[3, 14, 19, 30, 32, 39, 46],
[3, 7, 12, 16, 20, 42, 48],
[4, 6, 13, 19, 26, 29, 47],
[1, 3, 13, 18, 19, 39, 48],
[7, 10, 14, 20, 21, 23, 31],
[2, 18, 19, 29, 42, 47, 49],
[2, 6, 10, 12, 24, 30, 37],
[2, 10, 13, 15, 23, 28, 49],
[2, 7, 10, 22, 32, 34, 38],
[8, 23, 25, 26, 33, 41, 43],
[1, 16, 28, 29, 33, 37, 47],
[7, 9, 12, 20, 28, 38, 44],
[1, 10, 13, 26, 43, 46, 49],
[12, 21, 23, 27, 28, 29, 37],
[4, 13, 25, 29, 36, 40, 48],
[13, 15, 17, 18, 19, 47, 49],
[7, 10, 24, 30, 35, 36, 39],
[2, 6, 21, 26, 28, 33, 47],
[12, 15, 19, 20, 28, 29, 39],
[3, 14, 17, 25, 30, 33, 39],
[3, 4, 5, 8, 13, 22, 33],
[10, 12, 13, 25, 28, 29, 41],
[9, 22, 25, 30, 31, 39, 42],
[2, 5, 6, 43, 46, 47, 48],
[4, 17, 27, 32, 34, 39, 47],
[12, 17, 27, 28, 31, 36, 48],
[3, 14, 26, 27, 29, 32, 34],
[4, 5, 7, 8, 18, 30, 35],
[19, 25, 27, 29, 30, 36, 46],
[1, 5, 6, 32, 36, 38, 44],
[5, 7, 11, 40, 41, 47, 48],
[17, 19, 26, 29, 34, 35, 38],
[10, 14, 26, 34, 43, 47, 48],
[9, 10, 19, 24, 28, 30, 31],
[9, 19, 25, 26, 29, 30, 44],
[5, 22, 28, 31, 39, 46, 48],
[5, 6, 26, 29, 34, 36, 43],
[2, 7, 12, 25, 29, 32, 35],
[3, 18, 27, 30, 33, 40, 45],
[11, 18, 23, 24, 27, 28, 39],
[14, 16, 30, 35, 36, 45, 49],
[7, 17, 19, 23, 31, 36, 41],
[3, 6, 10, 14, 19, 25, 33],
[1, 3, 4, 5, 16, 32, 33],
[8, 11, 16, 21, 24, 28, 41],
[6, 7, 17, 20, 32, 44, 49],
[11, 16, 29, 30, 31, 33, 42],
[4, 9, 12, 15, 28, 29, 43],
[3, 11, 12, 16, 34, 36, 37],
[1, 3, 6, 34, 37, 42, 45],
[17, 18, 19, 21, 32, 40, 49],
[5, 8, 18, 22, 32, 39, 45],
[2, 27, 30, 32, 35, 36, 38],
[4, 23, 27, 32, 35, 43, 47],
[9, 12, 17, 23, 34, 42, 47],
[10, 19, 25, 29, 39, 41, 42],
[16, 17, 22, 24, 40, 41, 47],
[17, 26, 30, 32, 34, 39, 41],
[12, 17, 22, 30, 34, 43, 49],
[8, 17, 21, 23, 24, 28, 39],
[7, 9, 13, 18, 27, 33, 44],
[8, 9, 12, 13, 29, 30, 31],
[8, 10, 15, 17, 33, 34, 35],
[1, 4, 5, 7, 22, 29, 48],
[1, 6, 13, 19, 32, 35, 40],
[11, 15, 24, 26, 37, 38, 43],
[2, 8, 28, 30, 36, 39, 42],
[8, 18, 27, 28, 38, 41, 48],
[2, 7, 8, 11, 16, 17, 18],
[6, 9, 10, 14, 17, 18, 19],
[4, 7, 10, 12, 23, 25, 36],
[4, 10, 18, 20, 31, 35, 44],
[5, 15, 25, 38, 42, 46, 47],
[8, 27, 28, 29, 31, 32, 35],
[5, 17, 19, 25, 31, 38, 46]
]
const getLinesCache = (lines) => {
const cache = {}
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
cache[line[0]] = {}
cache[line[0]][line[1]] = {}
cache[line[0]][line[1]][line[2]] = {}
cache[line[0]][line[1]][line[2]][line[3]] = {}
cache[line[0]][line[1]][line[2]][line[3]][line[4]] = {}
cache[line[0]][line[1]][line[2]][line[3]][line[4]][line[5]] = {}
cache[line[0]][line[1]][line[2]][line[3]][line[4]][line[5]][line[6]] = {}
}
return cache
}
pastWinnerCache = getLinesCache(pastWinners)
// Chooser your favorite number and change the value from 0-100 based on how lucky it is
const choices = {
1: 1,
2: 1,
3: 1,
4: 1,
5: 1,
6: 1,
7: 1,
8: 1,
9: 1,
10: 1,
11: 1,
12: 1,
13: 1,
14: 1,
15: 1,
16: 1,
17: 1,
18: 1,
19: 1,
20: 1,
21: 1,
22: 1,
23: 1,
24: 1,
25: 1,
26: 1,
27: 1,
28: 1,
29: 1,
30: 1,
31: 1,
32: 1,
33: 1,
34: 1,
35: 1,
36: 1,
37: 1,
38: 1,
39: 1,
40: 1,
41: 1,
42: 1,
43: 1,
44: 1,
45: 1,
46: 1,
47: 1,
48: 1,
49: 1,
50: 1
}
const totalGeneratedLines = 5
const totalPicksPerLine = 7
const generateLines = function() {
const max = 50
const weightedList = []
for (let choice in choices) {
for (let i = 0; i < choices[choice]; i++) {
weightedList.push(Number.parseInt(choice, 10))
}
}
const getRandomChoice = () => {
return weightedList[Math.floor(Math.random() * Math.floor(weightedList.length - 1))]
}
const ensureNotPicked = (line, pick) => {
for (let i = 0; i < line.length; i++) {
if (line[i] === pick) return false
}
return true
}
const ensureEvenOdd = (line, pick) => {
let odds = 0
let evens = 0
const isEven = (num) => {
return num % 2 === 0
}
if (isEven(pick))
evens++
else
odds++
for (let i = 0; i < line.length; i++) {
if (isEven(line[i]))
evens++
else
odds++
}
if (evens > 4) return false
if (odds > 4) return false
return true
}
const ensureLowHigh = (line, pick) => {
let high = 0
let low = 0
const isHigh = (num) => {
return num > 25
}
if (isHigh(pick))
high++
else
low++
for (let i = 0; i < line.length; i++) {
if (isHigh(line[i]))
high++
else
low++
}
if (high > 4) return false
if (low > 4) return false
return true
}
const ensureNotConsecutive = (line, pick) => {
for (let i = 0; i < line.length; i++) {
if (pick === line[i]+1 || pick === line[i]-1)
return false
}
return true
}
const ensureNotCommon = (line, pick) => {
if (pick === 1) return false
return true
}
const ensureNoPattern = (line, pick) => {
for (let i = 0; i < 10; i++) {
if (line[0] % i === 0
&& line[1] % i === 0
&& line[2] % i === 0
&& line[3] % i === 0
&& line[4] % i === 0
&& line[5] % i === 0
&& line[6] % i === 0)
return false
}
return true
}
const ensureAverageAddition = (line) => {
let total = 0
for (let i = 0; i < line.length; i++) {
total += line[i]
}
if (total < 120) return false
if (total > 210) return false
return true
}
const ensureNotSimilar = (lines, line) => {
for (let i = 0; i < lines.length; i++) {
let same = 0
for (let j = 0; j < lines[i].length; j++) {
if (line.includes(lines[i][j])) {
same++
if (same > 3) return false
}
}
}
return true
}
const ensureUnique = (lines, line) => {
const cache = getLinesCache(lines)
try {
return !Boolean(cache[line[0]][line[1]][line[2]][line[3]][line[4]][line[5]][line[6]])
} catch (e) {
}
return true
}
const ensureNeverWon = (line) => {
try {
return !Boolean(pastWinnerCache[line[0]][line[1]][line[2]][line[3]][line[4]][line[5]][line[6]])
} catch (e) {
}
return true
}
const getFiller = () => {
const goodFillers = []
// temp
return 1
}
const generatePick = (line) => {
const pick = getRandomChoice()
if (!ensureNotPicked(line, pick)) return
if (!ensureEvenOdd(line, pick)) return
if (!ensureLowHigh(line, pick)) return
if (!ensureNotConsecutive(line, pick)) return
if (!ensureNotCommon(line, pick)) return
if (!ensureNoPattern(line, pick)) return
return pick
}
const generateLine = () => {
let line = []
for (let i = 0; i < totalPicksPerLine; i++) {
const pick = generatePick(line)
if (!pick) {
i--
continue
}
line.push(pick)
}
line.sort(function (a, b) { return a - b })
if (!ensureAverageAddition(line)) return
if (!ensureNeverWon(line)) return
if (!ensureUnique(lines, line)) return
if (!ensureNotSimilar(lines, line)) return
return line
}
const lines = []
for (let i = 0; i < totalGeneratedLines; i++) {
const line = generateLine()
if (!line) {
i--
continue
}
lines.push(line)
}
return lines
}
@ericmuyser

This comment has been minimized.

Copy link
Owner Author

ericmuyser commented Sep 30, 2019

I like the idea of writing a script to win the lotto, even though it's highly unlikely it would be pretty cool. So I studied how to generate random numbers that are more likely to win, as well as less likely to be common picks (to avoid splits). If you have thoughts on how to improve it please let me know.

@ericmuyser

This comment has been minimized.

Copy link
Owner Author

ericmuyser commented Sep 30, 2019

Change the choices array with your lucky numbers (pick like 20, then their values to 100, and leave rest at 1 or change to 0 to not be picked)

@ericmuyser

This comment has been minimized.

Copy link
Owner Author

ericmuyser commented Sep 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.