Pyudorandom

1.0.0 · active · verified Thu Apr 16

Pyudorandom is a Python library that generates pseudorandom sequences by using algebraic methods. It allows iteration over a list in a non-successive, yet deterministic way, ensuring each item is yielded exactly once. This is particularly useful when you need to mix up items without the overhead or cryptographic guarantees of true randomness, often outperforming `random.shuffle` for longer lists. The current version is 1.0.0, and releases are generally made on an as-needed basis.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to use `pyudorandom.shuffle()` to obtain a new list with elements in a deterministic, non-successive order, and `pyudorandom.items()` to iterate through them.

import pyudorandom

my_list = [1, 5, 7, 3, 2, 8, 4, 6]

# Get a new list with elements in a 'pseudorandom' order
shuffled_list = pyudorandom.shuffle(my_list)
print(f"Original list: {my_list}")
print(f"Shuffled list: {shuffled_list}")

# Iterate through items in a 'pseudorandom' order
print("\nIterating through items:")
for item in pyudorandom.items(my_list):
    print(item)

view raw JSON →