npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@writegames.com/game-math

v0.7.1

Published

A library of useful math classes & functions for game development, involving linear algebra, angles, and more.

Readme

@writegames.com/game-math

A library of useful math classes & functions for game development, involving linear algebra, trigonometry, RNG, and more.

npm version

Installation

# choose based on your package manager
npm i @writegames.com/game-math
pnpm add @writegames.com/game-math
yarn add @writegames.com/game-math

What's Included

Linear Algebra

  • Vec2, Vec3, Vec4, Mat2, Mat3, and Mat4 classes
  • Dot products, cross products, vector-matrix multiplication, transformation matrices, and more

Random Number Generator

  • Random class
    • Uses xorShift32 as default random function
    • float(n) - returns a random float between [0, n) (exclusive)
    • chance(n, max) - returns true or false based off of n in max chances (ex: chance(1, 5) would return true 20% of the time)
    • int(n) - returns a random int between [0, n) (exclusive) (ex: int(3) would return 0, 1, or 2)
    • range(a, b) - returns a random float between [a, b) (exclusive)
    • bool() - returns true or false
    • sign() - returns -1 or 1
    • angle() - returns a random angle in degrees [0, 360)
    • choose(...items) - returns a random item from the items passed (ex: choose(1, 2, 3) would return 1, 2, or 3)
    • shuffle(arr) - shuffles an array using the Fisher–Yates shuffle algorithm
    • vec2(scale) - returns a random Vec2 of the length of scale (defaults to 1)
    • vec3(scale) - returns a random Vec3 of the length of scale (defaults to 1)

Directions

  • WIP

Trigonometry

  • WIP

Notes

While this is pre-1.0, GameMaker compatibility may be incomplete and/or broken.

Credits

© 2025 WriteGames.com. MIT License