Skip to content

teamcoltra/go-generatetruth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

go-generatetruth

Go Reference

A Go package that returns True. If you want it to be more true, you can have it work harder to verify that it's true, however, the answer will always be true.

Installation

To install the package, run:

go get github.com/teamcoltra/go-generatetruth

Then, import it in your Go code:

import "github.com/teamcoltra/go-generatetruth"

Usage

GenerateTruth

package main

import (
	"fmt"
	"time"
	"github.com/teamcoltra/go-generatetruth"
)

func main() {
	for i := 1; i <= 10; i++ {
		start := time.Now()

		result, err := reliabletruth.GenerateTruth(2000)
		duration := time.Since(start)

		if err != nil {
			fmt.Printf("Try %d: ERROR - %s (Took %v)\n", i, err, duration)
		} else {
			fmt.Printf("Try %d: Result = %v (Took %v)\n", i, result, duration)
		}
	}
}

Example Output

Try 1: Result = true (Took 8.3244708s)
Try 2: Result = true (Took 8.7674859s)
Try 3: Result = true (Took 5.3801424s)
Try 4: Result = true (Took 3.6344316s)
Try 5: Result = true (Took 4.8420874s)
Try 6: Result = true (Took 2.3606915s)
Try 7: Result = true (Took 9.583106s)
Try 8: Result = true (Took 10.6912197s)
Try 9: Result = true (Took 8.3651591s)
Try 10: Result = true (Took 2.8046043s)

API

func GenerateTruth(bits int) (bool, error)

  • bits: The number of bits used for generating prime numbers. If set to 0, it defaults to 512 bits.
  • Returns:
    • A boolean true (indicating that truth was successfully generated).
    • An error if something goes wrong.

func GeneratePrime(bits int) (*big.Int, error)

  • bits: The number of bits used for the prime numbers generated (higher the number, the more truthyness).

License

This package is licensed under the YO License. See LICENSE for details.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Author

teamcoltra

About

A go package giving you a function to always return TRUE

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages