Skip to content

Commit 0466591

Browse files
committed
Updated chaos machine algorithm
1 parent 7520f65 commit 0466591

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

hashes/chaos_machine.py

+25-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
"""example of simple chaos machine
2-
Simple Chaos Machine refers to computational model that demonstrates chaotic behavior.
3-
It takes input values, applies a chaotic transformation using control theory principles, and generates
4-
unpredictable output ( meaning small changes in input lead to drastically different outputs over time),"""
1+
""" example of simple chaos machine
2+
Simple Chaos Machine refers to computational model
3+
that demonstrates chaotic behavior. It takes input values,
4+
applies a chaotic transformation using control theory
5+
principles, and generates unpredictable output ( meaning
6+
small changes in input lead to drastically different outputs
7+
over time),"""
58

69
""" Chaos Machine (K, t, m)
710
K --> Initial values for the buffer space.
@@ -12,18 +15,24 @@
1215
t = 3
1316
m = 5
1417

15-
# Buffer Space (with Parameters Space) --> Stores values undergoing chaotic transformation.
18+
# Buffer Space (with Parameters Space)
19+
# --> Stores values undergoing chaotic transformation.
1620
buffer_space: list[float] = []
1721

1822
# Stores parameters controlling the transformation.
1923
params_space: list[float] = []
2024

21-
# Machine Time --> Keeps track of execution time.
25+
# Machine Time
26+
# --> Keeps track of execution time.
2227
machine_time = 0
2328

24-
"""The push() function updates the buffer_space and params_space by applying chaotic transformations
25-
based on control theory. It modifies all values in the buffer_space using an orbit change and trajectory change formula,
26-
which ensure values to stay within controlled chaotic limits. Finally, it increments machine_time."""
29+
"""The push() function updates the buffer_space and
30+
params_space by applying chaotic transformations
31+
based on control theory. It modifies all values in the
32+
buffer_space using an orbit change and trajectory
33+
change formula, which ensure values to stay within
34+
controlled chaotic limits. Finally, it increments
35+
machine_time."""
2736
def push(seed):
2837
global buffer_space, params_space, machine_time, K, m, t
2938

@@ -50,9 +59,13 @@ def push(seed):
5059
machine_time += 1
5160

5261

53-
"""The pull() function generates a chaotic pseudo-random number using a logistic map transformation
54-
and the Xorshift algorithm. It updates buffer_space and params_space over multiple iterations, ensuring chaotic evolution.
55-
Finally, it selects two chaotic values, applies Xorshift, and returns a 32-bit random number."""
62+
"""The pull() function generates a chaotic pseudo-random
63+
number using a logistic map transformation and the
64+
Xorshift algorithm. It updates buffer_space and params_space
65+
over multiple iterations, ensuring chaotic evolution. Finally,
66+
it selects two chaotic values, applies Xorshift, and returns a
67+
32-bit random number."""
68+
5669
def pull():
5770
global buffer_space, params_space, machine_time, K, m, t
5871

0 commit comments

Comments
 (0)