Documentation ¶
Overview ¶
Package spherand generates random points uniformly on a sphere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Geographical ¶
func Geographical() (lat, lng float64)
Geographical returns a random geographical point as latitude in degrees between -90 and 90, and longitude between -180 and 180. This package level function uses the default random source.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator can generate spherical points based on a configured source of uniform random values.
func NewGenerator ¶
func NewGenerator(sampler UniformSampler) Generator
NewGenerator builds a Generator backed by the given uniform sampler. Note that the standard library rand.Rand can be used as a UniformSampler.
func (Generator) Geographical ¶
Geographical returns a random geographical point as latitude in degrees between -90 and 90, and longitude between -180 and 180.
type UniformSampler ¶
type UniformSampler interface {
Float64() float64
}
UniformSampler generates samples from the uniform distribution on [0,1).
type UniformSamplerFunc ¶
type UniformSamplerFunc func() float64
UniformSamplerFunc can satisfy the UniformSampler interface with a plain function.