]> git.lizzy.rs Git - generate-random.git/blob - README.md
Add support for cgmath and collision
[generate-random.git] / README.md
1 # Generate-Random
2
3 Generate random data.
4
5 ## Example
6
7 ```rust
8 use generate_random::GenerateRandom;
9
10 #[derive(GenerateRandom)]
11 enum MyEnum {
12     A,
13     C(bool),
14     B {
15         x: u8,
16     },
17     // Providing a weight allows changing the probabilities.
18     // This variant is now twice as likely to be generated as the others.
19     #[weight(2)]
20     D,
21 }
22
23 let mut rng = rand::thread_rng();
24 let my_value = MyEnum::generate_random(&mut rng);
25 ```
26
27 ## Documentation
28
29 [Documentation](https://lib.rs/crates/generate-random)