rand

package
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coprime

func Coprime(N int) int
Example
package main

import (
	"fmt"

	"github.com/itsubaki/q/math/rand"
)

func main() {
	p := rand.Coprime(15)

	for _, e := range []int{2, 4, 7, 8, 11, 13, 14} {
		if p == e {
			fmt.Println("found")
			break
		}
	}

}
Output:

found

func Crypto

func Crypto(_ ...int) float64

func CryptoInt64

func CryptoInt64(min, max int64) int64
Example
package main

import (
	"fmt"

	"github.com/itsubaki/q/math/rand"
)

func main() {
	r := rand.CryptoInt64(2, 14)

	for _, e := range []int64{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} {
		if r == e {
			fmt.Println("found")
			break
		}
	}

}
Output:

found

func Math added in v0.0.2

func Math(seed ...int) float64
Example
package main

import (
	"fmt"

	"github.com/itsubaki/q/math/rand"
)

func main() {
	fmt.Printf("%.13f\n", rand.Math(1))
	fmt.Printf("%.13f\n", rand.Math(2))
	fmt.Printf("%.13f\n", rand.Math(3))

}
Output:

0.6046602879796
0.1672966344259
0.7199826688373

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL