16 lines
415 B
Python
16 lines
415 B
Python
|
import random
|
||
|
|
||
|
|
||
|
def creer_enchevetrements(bag, i, max_en):
|
||
|
"""creer une suite d'enchevetrement aleatoire """
|
||
|
autre_baguettes = bag[:]
|
||
|
autre_baguettes.pop(i)
|
||
|
return [(random.choice(autre_baguettes), i) for _ in range(random.randint(1, max_en))]
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
for _ in range(100):
|
||
|
p = list(range(42))
|
||
|
random.shuffle(p)
|
||
|
print(creer_enchevetrements(p, 8, 10))
|