# Crate rand_simple

Expand description

## rand_simple

`rand_simple` is a Rust crate designed for efficient generation of pseudo-random numbers based on the Xorshift160 algorithm. It offers the following key features:

If you are seeking an effective solution for random number generation in Rust, `rand_simple` is a reliable choice. Start using it quickly and efficiently, taking advantage of its user-friendly features.

### Usage Examples

For graph-based examples, please refer to this repository.

#### Uniform Distribution

``````let seed: u32 = rand_simple::generate_seeds!(1_usize)[0];
let mut uniform = rand_simple::Uniform::new(seed);
assert_eq!(format!("{uniform}"), "Range (Closed Interval): [0, 1]");
println!("Returns a random number -> {}", uniform.sample());

// When changing the parameters of the random variable
let min: f64 = -1_f64;
let max: f64 = 1_f64;
let result: Result<(f64, f64), &str> = uniform.try_set_params(min, max);
assert_eq!(format!("{uniform}"), "Range (Closed Interval): [-1, 1]");
println!("Returns a random number -> {}", uniform.sample());``````

#### Normal Distribution

``````let seeds: [u32; 2_usize] = rand_simple::generate_seeds!(2_usize);
let mut normal = rand_simple::Normal::new(seeds);
assert_eq!(format!("{normal}"), "N(Mean, Std^2) = N(0, 1^2)");
println!("Returns a random number -> {}", normal.sample());

// When changing the parameters of the random variable
let mean: f64 = -3_f64;
let std: f64 = 2_f64;
let result: Result<(f64, f64), &str> = normal.try_set_params(mean, std);
assert_eq!(format!("{normal}"), "N(Mean, Std^2) = N(-3, 2^2)");
println!("Returns a random number -> {}", normal.sample());``````

### Implementation Status

#### Continuous distribution

• Uniform distribution
• 3.1 Normal distribution
• 3.2 Half Normal distribution
• 3.3 Log-Normal distribution
• 3.4 Cauchy distribution
• Half-Cauchy distribution
• 3.5 Lévy distribution
• 3.6 Exponential distribution
• 3.7 Laplace distribution
• Log-Laplace distribution
• 3.8 Rayleigh distribution
• 3.9 Weibull distribution
• Reflected Weibull distribution
• Fréchet distribution
• 3.10 Gumbel distribution
• 3.11 Gamma distribution
• 3.12 Beta distribution
• 3.13 Dirichlet distribution
• 3.14 Power Function distribution
• 3.15 Exponential Power distribution
• 3.16 Erlang distribution
• 3.17 Chi-Square distribution
• 3.18 Chi distribution
• 3.19 F distribution
• 3.20 t distribution
• 3.21 Inverse Gaussian distribution
• 3.22 Triangular distribution
• 3.23 Pareto distribution
• 3.24 Logistic distribution
• 3.25 Hyperbolic Secant distribution
• 3.26 Raised Cosine distribution
• 3.27 Arcsine distribution
• 3.28 von Mises distribution
• 3.29 Non-Central Gammma distribution
• 3.30 Non-Central Beta distribution
• 3.31 Non-Central Chi-Square distribution
• 3.32 Non-Central Chi distribution
• 3.33 Non-Central F distribution
• 3.34 Non-Central t distribution
• 3.35 Planck distribution

#### Discrete distributions

• Bernoulli distribution
• 4.1 Binomial distribution
• 4.2 Geometric distribution
• 4.3 Poisson distribution
• 4.4 Hypergeometric distribution
• 4.5 Multinomial distribution
• 4.6 Negative Binomial distribution
• 4.7 Negative Hypergeometric distribution
• 4.8 Logarithmic Series distribution
• 4.9 Yule-Simon distribution
• 4.10 Zipf-Mandelbrot distribution
• 4.11 Zeta distribution