Versions in this module Expand all Collapse all v0 v0.0.2 Jun 16, 2026 v0.0.1 Jun 10, 2026 Changes in this version + var Once sync.Once + func ChooseFromArrayN[T any](m *MathHelper, arr []T, n int) []T + func ChooseFromArray[T any](m *MathHelper, arr []T) (T, bool) + func ChooseWeighted[T any](m *MathHelper, weights []float32, args ...T) T + func Choose[T any](m *MathHelper, args ...T) T + func Shuffle[T any](m *MathHelper, arr []T) + type MathHelper struct + func GetInstance() MathHelper + func NewMathHelper() MathHelper + func (m *MathHelper) RandomArray(n int, min, max float32) []float32 + func (m *MathHelper) RandomArray2D(rows, cols int, min, max float32) [][]float32 + func (m *MathHelper) RandomArray2DInt(rows, cols, min, max int) [][]int + func (m *MathHelper) RandomArrayInt(n, min, max int) []int + func (m *MathHelper) RandomBool() bool + func (m *MathHelper) RandomChance(p float32) bool + func (m *MathHelper) RandomRangeDouble(min, max float32) float32 + func (m *MathHelper) RandomRangeDouble64(min, max float64) float64 + func (m *MathHelper) RandomRangeInt(min, max int) int + func (m *MathHelper) RandomRangeInt32(min, max int32) int32 + func (m *MathHelper) SetSeed(seed int64) + func (m MathHelper) Angle(x1, y1, x2, y2 float32) float32 + func (m MathHelper) AngleAdd(angle, amount float32) float32 + func (m MathHelper) AngleAddV(dir Vec2, amountDeg float32) Vec2 + func (m MathHelper) AngleDif(angle1, angle2 float32) float32 + func (m MathHelper) AngleDifV(v1, v2 Vec2) float32 + func (m MathHelper) AngleV(x1, y1, x2, y2 float32) Vec2 + func (m MathHelper) Approach(current, target, amount float32) float32 + func (m MathHelper) Clamp(val, min, max float32) float32 + func (m MathHelper) CompareDistance(x1, y1, x2, y2, x3, y3, x4, y4 float32) int + func (m MathHelper) DirFromDeg(deg float32) Vec2 + func (m MathHelper) Distance(x1, y1, x2, y2 float32) float32 + func (m MathHelper) DistanceSq(x1, y1, x2, y2 float32) float32 + func (m MathHelper) IsInFOV(ox, oy float32, forward Vec2, tx, ty, halfFOVDeg float32) bool + func (m MathHelper) LengthDirV(length float32, dir Vec2) Vec2 + func (m MathHelper) LengthDirX(length, direction float32) float32 + func (m MathHelper) LengthDirY(length, direction float32) float32 + func (m MathHelper) Lerp(a, b, t float32) float32 + func (m MathHelper) Reflect(v, normal Vec2) Vec2 + func (m MathHelper) RotateV(vec, dir Vec2) Vec2 + func (m MathHelper) Sign(val float64) int + func (m MathHelper) SlerpDir(from, to Vec2, t float32) Vec2 + func (m MathHelper) SlerpDirDeg(fromDeg, toDeg, t float32) float32 + func (m MathHelper) Snap(val, step float32) float32 + func (m MathHelper) ToDeg(v Vec2) float32 + func (m MathHelper) Wrap(val, min, max float32) float32 + type Vec2 struct + X float32 + Y float32 + func (a Vec2) Add(b Vec2) Vec2 + func (a Vec2) Conj() Vec2 + func (a Vec2) Cross(b Vec2) float32 + func (a Vec2) Dot(b Vec2) float32 + func (a Vec2) Len() float32 + func (a Vec2) LenSq() float32 + func (a Vec2) Mul(b Vec2) Vec2 + func (a Vec2) Norm() Vec2 + func (a Vec2) Scale(s float32) Vec2 + func (a Vec2) Sub(b Vec2) Vec2 + type WeightedTable struct + func NewWeightedTable[T any](items []T, weights []float32) *WeightedTable[T] + func (t *WeightedTable[T]) Choose(m *MathHelper) T