grand

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rand

func Rand(n int) int

Rand returns range in [0~n)

Example
package main

import (
	"fmt"

	"github.com/giant-stone/go/grand"
)

func main() {
	fmt.Println(grand.Rand(10))
	fmt.Println(grand.Rand(3))
}
Output:

func RandRange added in v0.0.16

func RandRange(min, max int) int

Rand returns range in [min~max]

Example
package main

import (
	"fmt"

	"github.com/giant-stone/go/grand"
)

func main() {
	fmt.Println(grand.RandRange(1_000, 9_999))
	fmt.Println(grand.RandRange(100_0000, 999_9999))
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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