Documentation ¶
Index ¶
- Variables
- func IsAlmostEqualFloat32(a, b float32) bool
- func IsAlmostEqualFloat64(a, b float64) bool
- func RandFloat(min, max float64) float64
- func RandInt(min, max int) int
- func RangePerm(min, max int) []int
- func RoundFloat(x float64) float64
- func RoundHalf(v float64) int
- func SignAndMagnitudeToBiasedFloat32(sam uint32) uint32
- func SignAndMagnitudeToBiasedFloat64(sam uint64) uint64
- type F32
- type F64
- type I16
- type I32
- type I64
- type I8
- type INT
- type LCRNG
- type Point2
- type Rectangle
- type U16
- type U32
- type U64
- type U8
- type UINT
- type Vec2
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsAlmostEqualFloat32 ¶
func IsAlmostEqualFloat64 ¶
Returns true if this number is at most kMaxUlps ULP's away from rhs. In particular, this function:
- returns false if either number is (or both are) NAN.
- treats really large numbers as almost equal to infinity.
- thinks +0.0 and -0.0 are 0 DLP's apart.
func RoundFloat ¶
func SignAndMagnitudeToBiasedFloat64 ¶
Converts an integer from the sign-and-magnitude representation to the biased representation. More precisely, let N be 2 to the power of (kBitCount - 1), an integer x is represented by the unsigned number x + N.
For instance,
-N + 1 (the most negative number representable using sign-and-magnitude) is represented by 1; 0 is represented by N; and N - 1 (the biggest number representable using sign-and-magnitude) is represented by 2N - 1.
Read http://en.wikipedia.org/wiki/Signed_number_representations for more details on signed number representations.
Types ¶
type LCRNG ¶ added in v1.0.2
type LCRNG struct {
// contains filtered or unexported fields
}
线性同余数法 Linear congruential random number generator see https://en.wikipedia.org/wiki/Linear_congruential_generator
type Point2 ¶ added in v1.0.2
type Point2 struct {
X, Y int
}
Two dimensional point
var EmptyPoint Point2
type Rectangle ¶ added in v1.0.2
var (
EmptyRect Rectangle
)
func NewRectangle ¶ added in v1.0.2
func RectIntersect ¶ added in v1.0.2
Creates a rectangle that represents the intersetion between a and b
func (*Rectangle) Contains ¶ added in v1.0.2
Determines if a point is contained within the rectangle
func (*Rectangle) ContainsPoint ¶ added in v1.0.2
func (*Rectangle) ContainsRegion ¶ added in v1.0.2
func (*Rectangle) GetVertexes ¶ added in v1.0.2
func (*Rectangle) IsIntersectsWith ¶ added in v1.0.2
Determines if this rectangle intersets with rect.
type Vec2 ¶ added in v1.0.2
type Vec2 struct {
X, Y int
}
Two dimensional vector.
func NewVec2ByPoint ¶ added in v1.0.2
Allocates and returns a new 2D vector.