Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsonff committed Mar 4, 2023
1 parent 653b7d7 commit 10c4304
Showing 1 changed file with 83 additions and 1 deletion.
84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,83 @@
A quantum random number generator for Go.
<!-- Code generated by gomarkdoc. DO NOT EDIT -->

# qrand

```go
import "qrand"
```

Package qrand provides true random numbers generated from the ANU Quantum Random Numbers Server, https://qrng.anu.edu.au, to which you must have connectivity for true randomness. Randomness from the quantum beyond\!\!\! Fallback to Go's crypto/rand package in the event of no connectivity, but also return a PseudoRandomError.

## Index

- [Variables](<#variables>)
- [func Get(size int) (out []byte, err error)](<#func-get>)
- [type PseudoRandomError](<#type-pseudorandomerror>)
- [func (f PseudoRandomError) Error() string](<#func-pseudorandomerror-error>)
- [type Reader](<#type-reader>)
- [func (r *Reader) Read(p []byte) (n int, err error)](<#func-reader-read>)


## Variables

Attempts is the number of times to retry\(\) the GET request if an error occurs.

```go
var Attempts int = 2
```

The way their site's api works...

```go
var ILength = 10 //Number of "packages" to receive
```

```go
var ISize = 2 //Number of "items" in those packages
```

SleepTime is the time to wait between retry\(\) attempts.

```go
var SleepTime time.Duration = time.Second * 1
```

## func [Get](<https://github.com/davidsonff/qrand/blob/master/qrand.go#L58>)

```go
func Get(size int) (out []byte, err error)
```

func Get returns a quantum random \[\]byte of size and a nil error, or a pseudo\-random \[\]byte of size and an error of type PseudoRandomError, or nil and a regular, old error.

## type [PseudoRandomError](<https://github.com/davidsonff/qrand/blob/master/qrand.go#L31>)

PseudoRandomError is the error type returned if no complete interaction with the WebSite occurs and a pseudo\-random \[\]byte is returned instead. Check for it with "if \_, ok := x.\(qrand.PseudoRandomError\); ok \{..."
```go
type PseudoRandomError struct{}
```
### func \(PseudoRandomError\) [Error](<https://github.com/davidsonff/qrand/blob/master/qrand.go#L36>)
```go
func (f PseudoRandomError) Error() string
```
## type [Reader](<https://github.com/davidsonff/qrand/blob/master/qrand.go#L34>)
Reader is a drop\-in, true random number generator replacement for crypto/rand's Reader.
```go
type Reader struct{}
```
### func \(\*Reader\) [Read](<https://github.com/davidsonff/qrand/blob/master/qrand.go#L40>)
```go
func (r *Reader) Read(p []byte) (n int, err error)
```
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)

0 comments on commit 10c4304

Please sign in to comment.