easyrand

Crates.ioeasyrand
lib.rseasyrand
version0.4.0
sourcesrc
created_at2019-05-07 12:30:22.659008
updated_at2021-04-13 06:05:06.386663
descriptionSimpler to use random number library for the Rust language
homepage
repositoryhttps://github.com/dbr/easyrand-rs
max_upload_size
id132577
size13,428
dbr/Ben (dbr)

documentation

README

easyrand

Build Status Crates.io version Documentation

Simple to use random number library for the Rust language.

The library wraps the rand crate, exposing a smaller API somewhat inspired by the Python random module. Similar in concept to reqwest being a wrapper for the more complex hyper.

Usage

Add to Cargo.toml:

[dependencies]
easyrand="0.4"

Then to use:

extern crate easyrand;

// Generate a random f64 between 0 and 1
let r = easyrand::random();

// Or for a given range
let r = easyrand::randrange(0.0, 10.0);

// Generate a random integer
let r = easyrand::randint(0, 99);

// Shuffle a vector
let mut inputs = vec!["a", "b", "c", "d"];
easyrand::shuffle(&mut inputs);

Project scope

This library is intended to be a small subset of the rand library, exposing only the simplest possible useful subset of the library. If you need anything more specific, use the underlying rand library.

Commit count: 28

cargo fmt