aboutsummaryrefslogtreecommitdiff
path: root/lib/README.md
diff options
context:
space:
mode:
authorAlexander van Ratingen <470642+alvra@users.noreply.github.com>2022-04-21 22:27:03 +0200
committerAlexander van Ratingen <470642+alvra@users.noreply.github.com>2022-04-21 22:27:03 +0200
commitcdf244ae18202ad3d4fd006c6478a9409b77defe (patch)
treed1dc69a2f4fa884c389cd651d4d64abba7ae97e5 /lib/README.md
parent645d3f8d22136d58d65f034fc15ea748d751eb96 (diff)
downloadgenerate-random-cdf244ae18202ad3d4fd006c6478a9409b77defe.tar.xz
Add readmes for all published crates.
Diffstat (limited to 'lib/README.md')
-rw-r--r--lib/README.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/README.md b/lib/README.md
new file mode 100644
index 0000000..c2458ae
--- /dev/null
+++ b/lib/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)