noisyrng 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ {
2
+ "python-envs.defaultEnvManager": "ms-python.python:system"
3
+ }
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.5
2
+ Name: noisyrng
3
+ Version: 0.1.0
4
+ Summary: A random number generator seeded from live system stats (CPU, RAM, disk, network)
5
+ Requires-Python: >=3.8
6
+ Requires-Dist: psutil
7
+ Description-Content-Type: text/markdown
8
+
9
+ # noisyrng
10
+
11
+ A random number generator seeded from live system stats: CPU load, RAM, swap, disk usage and network traffic.
12
+
13
+ Not suitable for cryptography or security. Use Python's `secrets` module for that.
14
+ This is for simpler approaches, and is kinda lightweight (i think)
15
+
16
+ ## Install
17
+
18
+ ```
19
+ pip install noisyrng
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from noisyrng import rng
26
+
27
+ print(rng(1, 1000)) # whole number from 1 to 1000
28
+ ```
@@ -0,0 +1,20 @@
1
+ # noisyrng
2
+
3
+ A random number generator seeded from live system stats: CPU load, RAM, swap, disk usage and network traffic.
4
+
5
+ Not suitable for cryptography or security. Use Python's `secrets` module for that.
6
+ This is for simpler approaches, and is kinda lightweight (i think)
7
+
8
+ ## Install
9
+
10
+ ```
11
+ pip install noisyrng
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```python
17
+ from noisyrng import rng
18
+
19
+ print(rng(1, 1000)) # whole number from 1 to 1000
20
+ ```
@@ -0,0 +1,11 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "noisyrng"
7
+ version = "0.1.0"
8
+ description = "A random number generator seeded from live system stats (CPU, RAM, disk, network)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ dependencies = ["psutil"]
@@ -0,0 +1,3 @@
1
+ import noisyrng
2
+
3
+ print(noisyrng.rng(1,1000))
@@ -0,0 +1,27 @@
1
+ import psutil
2
+
3
+ def random_seed():
4
+ # CPU
5
+ cpu = psutil.cpu_percent(interval=0.1)
6
+
7
+ # Memory
8
+ ram = psutil.virtual_memory().percent
9
+ swap = psutil.swap_memory().free
10
+
11
+ # Disk
12
+ disk = psutil.disk_usage("/").percent
13
+ disk2 = psutil.disk_usage("/").free
14
+ disk3 = psutil.disk_usage("/").used
15
+
16
+ # Network
17
+ net = psutil.net_io_counters().bytes_recv + 1
18
+ net2 = psutil.net_io_counters().bytes_sent + 1
19
+
20
+ seed = float(cpu) * float(ram) + swap / net * disk + net2 * disk2 / disk3
21
+ return seed
22
+
23
+
24
+ def rng(minimum, maximum):
25
+ seed = int(random_seed() * 1000)
26
+ seed = (seed * 1103515245 + 12345) % (2**31)
27
+ return minimum + seed % (maximum - minimum + 1)