Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Generation simple d'un triangle de Sierpinski avec une méthode aléatoire.
- """
- import random
- x0, y0 = 0, 0
- x1, y1 = -100, 100
- x2, y2 = 100, 100
- sommets = ((x0, y0), (x1, y1), (x2, y2))
- x, y = 0, 0
- with open('out.txt', 'w') as fichier:
- for _ in range(100000):
- i = random.randint(0, 2)
- x = (sommets[i][0] + x) / 2
- y = (sommets[i][1] + y) / 2
- print(f"{x} {y}", file=fichier)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement