#random #rng

no-std rand_core

Core random number generator traits and tools for implementation

6 releases

0.2.1 Jun 8, 2018
0.2.0 May 21, 2018
0.1.0 Apr 17, 2018
0.1.0-pre.0 Mar 23, 2018
0.0.1 Sep 14, 2017

#12 in Algorithms

Download history 8226/week @ 2018-07-04 11923/week @ 2018-07-11 13641/week @ 2018-07-18 19430/week @ 2018-07-25 25094/week @ 2018-08-01 30769/week @ 2018-08-08 29251/week @ 2018-08-15 26020/week @ 2018-08-22 36346/week @ 2018-08-29 38619/week @ 2018-09-05 44580/week @ 2018-09-12 47826/week @ 2018-09-19 40138/week @ 2018-09-26

8,271 downloads per month
Used in 3,170 crates (13 directly)

MIT/Apache

56KB
638 lines

rand_core

Build Status Build Status Latest version Documentation Minimum rustc version License

Core traits and error types of the rand library, plus tools for implementing RNGs.

This crate is intended for use when implementing the core trait, RngCore; it defines the core traits to be implemented as well as several small functions to aid in their implementation and types required for error handling.

The main rand crate re-exports most items defined in this crate, along with tools to convert the integer samples generated by RngCore to many different applications (including sampling from restricted ranges, conversion to floating point, list permutations and secure initialisation of RNGs). Most users should prefer to use the main rand crate.

Documentation: master branch, by release

Changelog

Functionality

The rand_core crate provides:

  • base random number generator traits
  • error-reporting types
  • functionality to aid implementation of RNGs

The traits and error types are also available via rand.

Crate Features

rand_core supports no_std and alloc-only configurations, as well as full std functionality. The differences between no_std and full std are small, comprising RngCore support for Box<R> types where R: RngCore, as well as extensions to the Error type's functionality.

Due to rust-lang/cargo#1596, rand_core is built without std support by default. Since features are unioned across the whole dependency tree, any crate using rand with its default features will also enable std support in rand_core.

The serde1 feature can be used to derive Serialize and Deserialize for RNG implementations that use the BlockRng or BlockRng64 wrappers.

License

rand_core is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.

Dependencies

~226KB