Advertisement
here2share

# Weak_Random_pattern_test.py

Aug 9th, 2023
1,086
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. # Weak_Random_pattern_test.py
  2.  
  3. seed = 2
  4. counter = 0
  5. def Weak_Random(vmin=0, vmax=100):
  6.     global counter, seed
  7.     seed = str(vmax//2)+str(seed)+'1'
  8.     vmax -= vmin
  9.     while True:
  10.         counter += 1
  11.         combo = (counter^counter*int(str(counter)+seed))%vmax+vmin
  12.         yield combo
  13.        
  14. gen = Weak_Random(vmin=0, vmax=9)
  15. test = []
  16. ttt = [[next(gen) for i in '.'*10]]
  17. print (ttt)
  18. while 1:
  19.     t = ttt[-1][1:] + [next(gen)]
  20.     if t not in ttt:
  21.         print(t, len(ttt))
  22.         ttt += [t]
  23.     else:
  24.         break
  25.        
  26. # ends at [1, 6, 0, 7, 7, 0, 3, 1, 0, 0] 18429
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement