Here is Python 3 code to demonstrate what I mentioned and example output based on the Texas Lotto (Pick 6 out of 54).
Code:
import random
max_ball = int(input('How many balls in your lotto game? '))
balls_picked = int(input('How many balls will be picked? '))
num_tickets = int(max_ball / balls_picked)
print(f'\n{num_tickets} plays are displayed with unique numbers in each play.\n')
ball_pool = [ball for ball in range(1, max_ball + 1)]
picks = []
for i in range(num_tickets):
current_pick = sorted(random.sample(ball_pool, k=balls_picked))
ticket_as_str = [str(ball) if ball > 9 else '0' + str(ball)
for ball in current_pick]
picks.append(ticket_as_str)
for ball in current_pick:
ball_pool.remove(ball)
for ticket in picks:
print(*ticket)
Example Output:
How many balls in your lotto game? 54
How many balls will be picked? 6
9 plays are displayed with unique numbers in each play.
13 21 30 33 48 52
01 20 22 25 41 50
03 16 32 38 43 53
02 07 18 19 31 44
04 12 23 27 28 47
06 11 17 42 45 51
15 29 39 46 49 54
05 10 14 26 36 40
08 09 24 34 35 37