mirror of
https://github.com/jimeh/rands.git
synced 2026-02-19 03:16:39 +00:00
27 lines
369 B
Go
27 lines
369 B
Go
package rands_test
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/jimeh/rands"
|
|
)
|
|
|
|
func ExampleInt() {
|
|
n, err := rands.Int(2147483647)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
fmt.Printf("%d\n", n) // => 1908357440
|
|
}
|
|
|
|
func ExampleInt64() {
|
|
n, err := rands.Int64(int64(9223372036854775807))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
fmt.Printf("%d\n", n) // => 6530460062499341591
|
|
}
|