From 5082385fb52f9233bc4e33896f95465262908e0d Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Sun, 21 Nov 2021 06:17:30 -0800 Subject: [PATCH] update docs --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index a2e1353..5a2416c 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,27 @@ **go-arbitrary** is a Go library which provides tools for generating arbitrary data. ## Example +Here is a typical example: +``` +// Generate an arbitrary phone‐number. +phoneNumber := arbitrary.PhoneNumber() + +// Generate an arbitrary bool. +// Might be false, might be true. +bl := arbitrary.Bool() + +// Generate an arbitrary string. +s := arbitrary.String() +``` + +Or if you want to provide your own souce of randomness: ``` src := rand.NewSource( time.Now().UTC().UnixNano() ) arb := arbitrary.New(src) +// Generate an arbitrary phone‐number. +phoneNumber := arb.PhoneNumber() + // Generate an arbitrary bool. // Might be false, might be true. bl := arb.Bool()