Skip to main content

parrot/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2
3//! # Parrot RNG 🦜
4//!
5//! **Parrot** (`parrot-rng`) is a lightweight, strictly deterministic procedural generation library.
6//!
7//! It is designed for game development, generative art, and embedded systems where reproducibility is critical.
8//! If you run a Parrot RNG with the seed `12345` on a high-end PC, a Raspberry Pi, or in a web browser (WASM),
9//! you will get the **exact same sequence of numbers**.
10//!
11//!
12//! ## Features
13//!
14//! * **Deterministic:** 100% portable results across all major architectures (x86, ARM, WASM).
15//! * **`#[no_std]`:** Works in embedded, resource-constrained, and bare-metal environments.
16//! * **String Seeds:** Use human-readable strings like "mountain" or "level-1" to seed your generators.
17//! * **Perlin Noise:** A stateless, immutable, and thread-safe 2D noise generator.
18//!
19//! ## Quick Start: RNG
20//!
21//! ```rust
22//! use parrot::prelude::*;
23//!
24//! // Create a new RNG from a seed
25//! let mut rng = Parrot::new(42);
26//!
27//! // Or from a string
28//! let mut rng_from_str = Parrot::new_from_str("hello world");
29//!
30//! // Generate a number between 0 and 99
31//! let x = rng.gen_range(0, 100);
32//!
33//! println!("Random number: {}", x);
34//! ```
35//!
36//! ## Quick Start: Perlin Noise
37//!
38//! ```rust
39//! use parrot::prelude::*;
40//!
41//! // Create a Perlin noise generator from a seed
42//! let noise = Perlin::new(123);
43//!
44//! // Or from a string
45//! let noise_from_str = Perlin::new_from_string("a-stable-seed");
46//!
47//! // Get a noise value at a 2D coordinate
48//! let value = noise.noise2d(0.5, 0.2);
49//!
50//! println!("Noise value: {}", value);
51//! ```
52
53pub mod hash;
54pub mod parrot;
55pub mod perlin;
56pub mod prelude;
57
58#[cfg(feature = "bevy-support")]
59pub mod bevy_ext;
60
61pub use parrot::Parrot;
62pub use parrot::ParrotRng;
63pub use parrot::RandomRange;
64pub use perlin::Perlin;
65
66#[cfg(feature = "bevy-support")]
67pub use bevy_ext::ParrotBevyExt;