Files
opencloud/vendor/github.com/brianvoe/gofakeit/v7/source/README.md
Pascal Bleser 7f19c8ecd3 groupware: improve jmap integration tests
* use gofakeit instead of loremipsum, as it can also fake images for
   attachments

 * random emails for testing: generate threads, add attachments
2026-02-10 17:04:00 +01:00

2.5 KiB

Random Number Generators Collection

This repository contains a collection of random number generators (RNGs) implemented in Go, designed to cater to a wide range of applications, from cryptographic operations to testing environments. Each RNG in the collection offers distinct features and performance characteristics, making it suitable for various use cases, including those requiring cryptographic security.

Generators

Crypto

  • Description: Utilizes Go's crypto/rand package to provide cryptographically secure random numbers, suitable for security-sensitive applications.
  • Usage:
    source := NewCryptoSource()
    number := source.Uint64()
    

JSF (Jenkins Small Fast)

  • Description: An implementation of the Jenkins Small Fast hash function for efficient pseudo-random number generation, balancing speed and randomness quality for general use.
  • Usage:
    source := NewJSFSource(seed)
    number := source.Uint64()
    

SFC (Simple Fast Counter)

  • Description: Based on the Simple Fast Counter algorithm, this source offers rapid number generation with satisfactory randomness properties, ideal for simulations and non-cryptographic applications.
  • Usage:
    source := NewSFCSource(seed)
    number := source.Uint64()
    

Dumb

  • Description: A deterministic generator designed primarily for testing, providing predictable output for scenarios where consistent results are more beneficial than high-quality randomness.
  • Usage:
    source := NewDumb(seed)
    number := source.Uint64()
    

Installation

To use these RNGs in your Go project, import the package as follows:

import "github.com/yourusername/randsource"

Replace yourusername with your GitHub username or organization name where the repository is hosted.

Usage

After importing the package, initialize the desired RNG with or without a seed (as applicable) and use the Uint64 method to generate random numbers. See the usage examples under each generator's description for more details.

Benchmarks

Performance benchmarks for each RNG are provided to help you choose the right generator for your application. These benchmarks cover various aspects, including speed and randomness quality.

For detailed benchmark results, see the Benchmarks file.

Contributing

We welcome contributions and suggestions! Please open an issue or submit a pull request with your improvements.