MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / pull

Function pull

hashes/chaos_machine.py:42–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40
41
42def pull():
43 global buffer_space, params_space, machine_time, K, m, t
44
45 # PRNG (Xorshift by George Marsaglia)
46 def xorshift(x, y):
47 x ^= y >> 13
48 y ^= x << 17
49 x ^= y >> 5
50 return x
51
52 # Choosing Dynamical Systems (Increment)
53 key = machine_time % m
54
55 # Evolution (Time Length)
56 for _ in range(t):
57 # Variables (Position + Parameters)
58 r = params_space[key]
59 value = buffer_space[key]
60
61 # Modification (Transition Function) - Flow
62 buffer_space[key] = round(float(r * value * (1 - value)), 10)
63 params_space[key] = (machine_time * 0.01 + r * 1.01) % 1 + 3
64
65 # Choosing Chaotic Data
66 x = int(buffer_space[(key + 2) % m] * (10**10))
67 y = int(buffer_space[(key - 2) % m] * (10**10))
68
69 # Machine Time
70 machine_time += 1
71
72 return xorshift(x, y) % 0xFFFFFFFF
73
74
75def reset():

Callers 1

chaos_machine.pyFile · 0.85

Calls 1

xorshiftFunction · 0.85

Tested by

no test coverage detected