Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/markcol/randf" ) func main() { r := randf.New() r.Seed(42) f := r.Float32() fmt.Println(f) }
Output: 0.94806355
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rand ¶
type Rand struct {
// contains filtered or unexported fields
}
A Rand is a sourcce of random numbers.
func New ¶
func New() *Rand
New returns a new Rand that uses random values to generate other random values.
func (*Rand) Float32 ¶
Float32 returns a random 32-bit floating-point number in the range [0.0,1.0], including 0.0, subnormals, and 1.0.
func (*Rand) Seed ¶
Seed uses the provided seed value to initialize the default Source to a deterministic state. If Seed is not called, the generator behaves as if seeded by Seed(1). Seed values that have the same remainder when divided by 2³¹-1 generate the same pseudo-random sequence. Seed is safe for concurrent use.
Click to show internal directories.
Click to hide internal directories.