"""Generation of non-unique 1d_lst and 2d_lst
- Function takes in a list of info about the non-unique list
- You can also import randint from random.
- Note that randint is inclusive and randrange is exclusive.
- If you are looking to generate unique lsts...
...you might want to use random.sample() on a lst of numbers.
"""
from random import randrange
dft = [10, 10, 100, 10]
def rand_1d(info = dft[:-1]):
r, low, high = info
return [randrange(low, high) for num in range(r)]
def rand_2d(info = dft):
*info_1d, rows = info
return [rand_1d(info_1d) for i in range(rows)]
randlst_gen = {
"rand_1d": rand_1d,
"rand_2d": rand_2d
}
r1, r2 = randlst_gen.values()