Skip to content

Go package provides math/rand.Source64 implementation based on crypto/rand.

License

Notifications You must be signed in to change notification settings

cristalhq/cryptorand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cryptorand

build-img pkg-img reportcard-img coverage-img version-img

Go package provides math/rand.Source64 implementation based on crypto/rand.

Features

  • Simple API.
  • Dependency-free.
  • Clean and tested code.

Install

Go version 1.19+

go get github.com/cristalhq/cryptorand

Example

r := rand.New(cryptorand.Source)

m := map[string]struct{}{}
for i := 0; i < 100; i++ {
	s := fmt.Sprint(r.Float64())
	m[s] = struct{}{}
}

fmt.Printf("Have %d unique floats", len(m))

// Output:
// Have 100 unique floats

See examples: example_test.go.

Documentation

See these docs for more details.

License

MIT License.

About

Go package provides math/rand.Source64 implementation based on crypto/rand.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages