random

package
Version: v0.0.0-...-1c48c43 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 3 Imported by: 4

Documentation

Overview

Package random provides a random generator with some weighed random functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Random

type Random struct {
	// contains filtered or unexported fields
}

Random is a random generator with convenient methods

func New

func New(seed int64) *Random

New returns a new Random object initialized with the given seed

func (*Random) Bool

func (r *Random) Bool() bool

Bool returns true or false at random

func (*Random) Float01

func (r *Random) Float01() float64

Float01 returns a random float between 0 and 1

func (*Random) Float02Pi

func (r *Random) Float02Pi() float64

Float02Pi returns a random float between 0 and 2*Pi

func (*Random) Float0A

func (r *Random) Float0A(a float64) float64

Float0A returns a random float between 0 and a

func (*Random) Float0Pi

func (r *Random) Float0Pi() float64

Float0Pi returns a random float between 0 and Pi

func (*Random) FloatAB

func (r *Random) FloatAB(a, b float64) float64

FloatAB returns a random float between 0 and a

func (*Random) Int0N

func (r *Random) Int0N(n int) int

Int0N returns a random int within [0..n]

func (*Random) Int320N

func (r *Random) Int320N(n int32) int32

Int320N returns a random int32 within [0..n]

func (*Random) Int32AB

func (r *Random) Int32AB(a, b int32) int32

Int32AB returns a random int32 within [a..b]

func (*Random) Int640N

func (r *Random) Int640N(n int64) int64

Int640N returns a random int64 within [0..n]

func (*Random) Int64AB

func (r *Random) Int64AB(a, b int64) int64

Int64AB returns a random int64 within [a..b]

func (*Random) IntAB

func (r *Random) IntAB(a, b int) int

IntAB returns a random int within [a..b]

func (*Random) NewSeed

func (r *Random) NewSeed() int64

NewSeed returns a random seed

func (*Random) Sign

func (r *Random) Sign() int

Sign returns -1 or 1 at random

func (*Random) Sign32

func (r *Random) Sign32() int32

Sign32 returns -1 or 1 at random

func (*Random) Sign64

func (r *Random) Sign64() int64

Sign64 returns -1 or 1 at random

func (*Random) Vec3Hemi

func (r *Random) Vec3Hemi(normal *maths.Vec3) *maths.Vec3

Vec3Hemi returns a random unit vector in the hemisphere defined by normal

func (*Random) Vec3HemiCos

func (r *Random) Vec3HemiCos(normal *maths.Vec3) *maths.Vec3

Vec3HemiCos returns a random unit vector chosen on a cosine-weighed hemisphere defined by normal

func (*Random) Vec3Sphere

func (r *Random) Vec3Sphere() *maths.Vec3

Vec3Sphere returns a random unit vector

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL