Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Weak_Random.py
- seed = 1
- counter = 0
- def Weak_Random(vmin=0, vmax=100):
- global counter, seed
- seed = str(vmax//2)+str(seed)+'1'
- vmax -= vmin
- while True:
- counter += 1
- rnd = (counter^counter*int(str(counter)+seed))%vmax+vmin
- yield rnd
- gen = Weak_Random(vmin=50, vmax=109)
- for _ in range(500):
- print(next(gen))
- counter = 490
- for _ in range(10):
- print(next(gen))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement