rand

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Intn

func Intn(max int) int

Intn generates a random non-negative integer within the range [0, max). The generated integer will be less than the provided maximum value. If max is less than or equal to 0, the function will treat it as if max is 1.

Usage:

max := 10
randomInt := Intn(max)
fmt.Printf("Random integer between 0 and %d: %d\n", max, randomInt)

Parameters:

  • max (int): The maximum bound for the random integer to be generated.

Returns:

  • int: A random non-negative integer within the specified range.

Types

This section is empty.

Jump to

Keyboard shortcuts

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