update docs
parent
d8ef8e226a
commit
5082385fb5
17
README.md
17
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()
|
||||
|
|
Loading…
Reference in New Issue