From 645d3f8d22136d58d65f034fc15ea748d751eb96 Mon Sep 17 00:00:00 2001 From: Alexander van Ratingen <470642+alvra@users.noreply.github.com> Date: Thu, 21 Apr 2022 22:16:02 +0200 Subject: Initial commit --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..c2458ae --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Generate-Random + +Generate random data. + +## Example + +```rust +use generate_random::GenerateRandom; + +#[derive(GenerateRandom)] +enum MyEnum { + A, + C(bool), + B { + x: u8, + }, + // Providing a weight allows changing the probabilities. + // This variant is now twice as likely to be generated as the others. + #[weight(2)] + D, +} + +let mut rng = rand::thread_rng(); +let my_value = MyEnum::generate_random(&mut rng); +``` + +## Documentation + +[Documentation](https://lib.rs/crates/generate-random) -- cgit v1.2.3