Skip to main content

Random number generator based on butterfly effect and chaotic maps

Project description

🦋 ButterRand

ButterRand là một thư viện Python sinh số ngẫu nhiên dựa trên hiệu ứng cánh bướm (Butterfly Effect) – một hiện tượng trong lý thuyết hỗn loạn, nơi các thay đổi nhỏ ban đầu có thể dẫn đến kết quả hoàn toàn khác biệt.

Thư viện này sử dụng các kỹ thuật như logistic map, sine map và các hàm gây nhiễu (sin, cos, tan,...) để tạo ra chuỗi số có tính hỗn loạn cao và cực kỳ khó dự đoán – phù hợp cho các mô phỏng phức tạp, các nghiên cứu khoa học, hoặc mục đích giáo dục.


🚀 Cài đặt

pip install butterrand

🧠 Ý tưởng phía sau

ButterRand dựa trên lý thuyết hệ động học hỗn loạn, cụ thể là hiệu ứng cánh bướm. Việc áp dụng logistic map và các hàm gây nhiễu phi tuyến tính giúp sinh ra chuỗi số không lặp lại theo kiểu cổ điển như các hàm ngẫu nhiên thông thường.


🔧 Cách sử dụng

from butterrand import ButterflyRandom

# Tạo một đối tượng sinh số ngẫu nhiên
br = ButterflyRandom(
    seed="abc123",            # Chuỗi hoặc số
    mode="logistic",          # Có thể là "logistic" hoặc "sine"
    noise_function="sin",     # "sin", "cos", "tan", ...
    epsilon=1e-8              # Độ nhiễu nhỏ để tạo hỗn loạn
)

print(br.next_float())        # Số thực từ 0.0 đến 1.0
print(br.next_int(1, 100))    # Số nguyên từ 1 đến 99

⚙️ Tham số khởi tạo

Tham số Kiểu dữ liệu Mô tả
seed str, int, float Giá trị khởi tạo, đảm bảo tính nhất quán nếu cần
mode str "logistic" hoặc "sine"
noise_function str hoặc callable Các hàm toán học "sin", "cos", "tan" hoặc hàm người dùng tự định nghĩa
epsilon float Một số rất nhỏ để tạo ra sự thay đổi không đáng kể nhưng gây hỗn loạn lớn

📦 Các hàm chính

Hàm Mô tả
next_float() Trả về số thực ngẫu nhiên trong khoảng (0.0, 1.0)
next_int(a, b) Trả về số nguyên ngẫu nhiên trong khoảng [a, b)

🧪 Ứng dụng

  • Mô phỏng hỗn loạn (chaos simulation)
  • Sinh dữ liệu mô phỏng (synthetic data)
  • Thị giác máy tính, nghệ thuật số
  • Giảng dạy và nghiên cứu về hệ động học hỗn loạn

⚠️ Không nên sử dụng cho bảo mật thực tế.


📁 MANIFEST.in

Đảm bảo thêm README.md vào gói khi đóng gói:

include README.md

📄 Giấy phép

MIT License – miễn phí sử dụng, chia sẻ và sửa đổi.


👤 Tác giả

Phát triển bởi [Điền tên bạn tại đây]


🦋 "Một cái đập cánh của con bướm ở Brazil có thể gây ra cơn lốc xoáy ở Texas."
— Edward Lorenz (cha đẻ lý thuyết hỗn loạn)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

butterrand-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

butterrand-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file butterrand-0.1.1.tar.gz.

File metadata

  • Download URL: butterrand-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for butterrand-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b5f24951a12491a09c98d6a76c25fdea05aa2e9909f396015c134c842907e0f8
MD5 4cc3cece8a207bdf3714a4b90fb3eb5d
BLAKE2b-256 66d46f3b0c35ec1cdeca0dbd0960ca144012b6683a64424574ed3be292d1e00e

See more details on using hashes here.

File details

Details for the file butterrand-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: butterrand-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for butterrand-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2d44dd5f37acf8e7214c03bb5fd75d7df0a455e6ebea2248db0995f3e7cee0a
MD5 66631b6588dfe5ab6c7d8a4460981321
BLAKE2b-256 6cce8d1d55626062d7e91e9bd3ff9bf95fb264666ba0253fcd458f7221e77cfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page