{"id":16616889,"url":"https://github.com/sebastienrousseau/vrd","last_synced_at":"2025-10-24T01:58:29.892Z","repository":{"id":161799780,"uuid":"636146031","full_name":"sebastienrousseau/vrd","owner":"sebastienrousseau","description":"A Rust library for generating high-quality random numbers based on the Mersenne Twister algorithm 🦀","archived":false,"fork":false,"pushed_at":"2024-11-18T17:15:49.000Z","size":1459,"stargazers_count":3,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-06T04:46:09.411Z","etag":null,"topics":["entropy","mersenne-twister","mersenne-twister-generator","rand","random","random-number-generator","rust","vrd"],"latest_commit_sha":null,"homepage":"http://doc.vrdlib.com/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sebastienrousseau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE-APACHE","code_of_conduct":".github/CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sebastienrousseau","custom":"https://paypal.me/wwdseb"}},"created_at":"2023-05-04T08:12:38.000Z","updated_at":"2024-08-27T17:53:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6b44fb0-ac74-4258-bff2-e0838abd4d74","html_url":"https://github.com/sebastienrousseau/vrd","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/sebastienrousseau/vrd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastienrousseau%2Fvrd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastienrousseau%2Fvrd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastienrousseau%2Fvrd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastienrousseau%2Fvrd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebastienrousseau","download_url":"https://codeload.github.com/sebastienrousseau/vrd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastienrousseau%2Fvrd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264000631,"owners_count":23542113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["entropy","mersenne-twister","mersenne-twister-generator","rand","random","random-number-generator","rust","vrd"],"created_at":"2024-10-12T02:14:34.547Z","updated_at":"2025-10-24T01:58:24.850Z","avatar_url":"https://github.com/sebastienrousseau.png","language":"Rust","funding_links":["https://github.com/sponsors/sebastienrousseau","https://paypal.me/wwdseb"],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD033 MD041 --\u003e\n\n\u003cimg src=\"https://kura.pro/vrd/images/logos/vrd.svg\"\nalt=\"Random (VRD) logo\" width=\"66\" align=\"right\" /\u003e\n\n\u003c!-- markdownlint-enable MD033 MD041 --\u003e\n\n# Random (VRD)\n\nA Rust library for generating high-quality random numbers based on the Mersenne\nTwister algorithm.\n\n[![Made With Love][made-with-rust]][11] [![Crates.io][crates-badge]][06] [![lib.rs][libs-badge]][08] [![Docs.rs][docs-badge]][07] [![Codecov][codecov-badge]][12] [![Build Status][build-badge]][09] [![GitHub][github-badge]][13]\n\n![divider][divider]\n\n\u003c!-- markdownlint-disable MD033 MD041 --\u003e\n\u003ccenter\u003e\n\u003c!-- markdownlint-enable MD033 MD041 --\u003e\n\n• [Website][00] • [Documentation][07] • [Report Bug][03]\n• [Request Feature][03] • [Contributing Guidelines][04]\n\n\u003c!-- markdownlint-disable MD033 MD041 --\u003e\n\u003c/center\u003e\n\u003c!-- markdownlint-enable MD033 MD041 --\u003e\n\n## Overview\n\n`Random (VRD)` is a Rust library for generating high-quality random numbers based on the Mersenne Twister algorithm.\n\nThe `Random` struct in this library provides a robust interface for generating a variety of random numbers using the Mersenne Twister algorithm. Additionally, the `MersenneTwisterConfig` struct allows for advanced configuration of the algorithm.\n\n`Random (VRD)` generates pseudorandom integers uniformly distributed in 0..(2^32 - 1), starting from any odd seed in 0..(2^32 - 1). The index is incremented after each random number is generated. When the index reaches 624, the array is reinitialized and the index is reset to 0.\n\n## Features\n\n- Create a new random number generator and seed it with a value.\n- Designed for speed and efficiency.\n- Generate random 32-bit unsigned integers within a given range.\n- Provide random numbers of different types, including booleans, bytes, chars, doubles, floats, integers, and unsigned integers.\n- Mutate the state of the random number generator.\n- Produce pseudorandom number sequences that are different from each other.\n- Regulate the randomness of the generated numbers, including the seed value and the number of bits used.\n- Select a random element from a slice of values.\n- Generate random numbers from various probability distributions, including uniform, normal, exponential, and Poisson.\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nvrd = \"0.0.8\"\nserde = { version = \"1.0.209\", features = [\"derive\"] }\n```\n\n## Usage\n\nHere's a quick example on how to use Random (VRD) to generate random numbers:\n\n```rust\nuse vrd::random::Random;\n\nlet mut rng = Random::new();\nlet rand_int = rng.int(1, 10);\nprintln!(\"Random integer between 1 and 10: {}\", rand_int);\n\nlet rand_float = rng.float();\nprintln!(\"Random float: {}\", rand_float);\n\nlet rand_bytes = rng.bytes(10);\nprintln!(\"Random bytes: {:?}\", rand_bytes);\n```\n\n## Documentation\n\nFor full API documentation, please visit \u003chttps://doc.libyml.com/vrd/\u003e or \u003chttps://docs.rs/vrd\u003e.\n\n## Rust Version Compatibility\n\nCompiler support: requires rustc 1.56.0+\n\n## Examples\n\n`Random (VRD)` provides a set of comprehensive examples. You can find them in the `examples` directory of the project. To run the examples, clone the repository and execute the following command in your terminal from the project:\n\n```shell\ncargo run --example\n```\n\n## Macros\n\nThe `Random (VRD)` library provides a set of macros that simplify the usage of the library. These macros offer a convenient way to generate random numbers of different types and distributions.\n\nHere are some of the available macros:\n\n- `rand_bool!(rng, probability)`: Generate a random boolean with the provided probability.\n- `rand_bytes!(rng, length)`: Generate a vector of random bytes with the specified length.\n- `rand_char!(rng)`: Generate a random character within the range 'a'..='z'.\n- `rand_choose!(rng, values)`: Generate a random element from a slice of values.\n- `rand_float!(rng)`: Generate a random float.\n- `rand_int!(rng, min, max)`: Generate a random integer within the given range.\n- `rand_uint!(rng, min, max)`: Generate a random 32-bit unsigned integer within the given range.\n- `rand_double!(rng)`: Generate a random double.\n- `rand_string!(rng, length)`: Generate a random string of the specified length.\n- `rand_alphanumeric!(rng)`: Generate a random alphanumeric character.\n- `rand_shuffle!(rng, slice)`: Shuffle a mutable slice randomly.\n- `rand_weighted_choice!(rng, choices, weights)`: Select a random element from a slice based on the provided weights.\n- `rand_normal!(rng, mu, sigma)`: Generate a normally distributed random number with the given mean and standard deviation.\n- `rand_exponential!(rng, rate)`: Generate a random number from the exponential distribution with the given rate parameter.\n- `rand_poisson!(rng, mean)`: Generate a random number from a Poisson distribution with the specified mean parameter.\n\nFor more details on how to use these macros, please refer to the [documentation](https://docs.rs/vrd).\n\n## Contributing\n\nContributions are welcome! Please submit a Pull Request on [GitHub][04].\n\n## Credits and Acknowledgements\n\nA big thank you to all the awesome contributors of [vrd][05] for their help and support.\n\nA special thank you goes to the [Rust Reddit][10] community for providing a lot of useful suggestions on how to improve this project.\n\n## License\n\nLicensed under either of the [Apache License][01] or the [MIT license][02] at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[00]: https://vrdlib.com \"Random (VRD)\"\n[01]: https://opensource.org/license/apache-2-0/ \"Apache License, Version 2.0\"\n[02]: https://opensource.org/licenses/MIT \"MIT license\"\n[03]: https://github.com/sebastienrousseau/vrd/issues \"Issues\"\n[04]: https://github.com/sebastienrousseau/vrd/blob/main/CONTRIBUTING.md \"Contributing Instructions\"\n[05]: https://github.com/sebastienrousseau/vrd/graphs/contributors \"Contributors\"\n[06]: https://crates.io/crates/vrd \"Crates.io\"\n[07]: https://docs.rs/vrd \"Docs.rs\"\n[08]: https://lib.rs/crates/vrd \"Lib.rs\"\n[09]: https://github.com/sebastienrousseau/vrd/actions?query=branch%3Amain\n[10]: https://reddit.com/r/rust \"Rust Reddit\"\n[11]: https://www.rust-lang.org \"The Rust Programming Language\"\n[12]: https://codecov.io/gh/sebastienrousseau/vrd \"Codecov\"\n[13]: https://github.com/sebastienrousseau/vrd/ \"GitHub\"\n\n[build-badge]: https://img.shields.io/github/actions/workflow/status/sebastienrousseau/vrd/release.yml?branch=main\u0026style=for-the-badge\u0026logo=github \"Build Status\"\n[codecov-badge]: https://img.shields.io/codecov/c/github/sebastienrousseau/vrd?style=for-the-badge\u0026token=oEisyTucB5 'Codecov'\n[crates-badge]: https://img.shields.io/crates/v/vrd.svg?style=for-the-badge 'Crates.io badge'\n[divider]: https://kura.pro/common/images/elements/divider.svg \"divider\"\n[docs-badge]: https://img.shields.io/docsrs/vrd.svg?style=for-the-badge 'Docs.rs badge'\n[github-badge]: https://img.shields.io/badge/github-sebastienrousseau/vrd-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github \"GitHub\"\n[libs-badge]: https://img.shields.io/badge/lib.rs-v0.0.8-orange.svg?style=for-the-badge 'Lib.rs badge'\n[made-with-rust]: https://img.shields.io/badge/rust-f04041?style=for-the-badge\u0026labelColor=c0282d\u0026logo=rust 'Made With Rust'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastienrousseau%2Fvrd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebastienrousseau%2Fvrd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastienrousseau%2Fvrd/lists"}