g.js — graphical objects for JavaScript

Math

GROB wraps typical mathematical operations and provides some of its own.

Generating numbers

makeNumbers — Create numbers from a string

sample / range — Generate numbers between the given min / max

randomNumbers — Create random numbers

perlinNoise — Compute Perlin noise

accumulate — Generate accumulated totals

Basic Math

add / subtract / multiply / divide / mod

negate — Switch the sign of a number

sqrt / log / pow

Conversion / rounding

integer / number — Convert to number types

round / floor / ceil — Different rounding methods

abs

Comparing / querying

compare — Compare two values

even / odd — Check if a number is even / odd

sign — Give the sign of the number

Trigonometry

sin / cos / tan

degrees / radians — Convert from degrees to radians and back

Mathematical constants

e / pi

Boolean operations

boolean — Create a boolean value

not — Negate a boolean value

and / or / xor — Logical AND, OR and XOR

Math on lists

average — Calculate average of the list

min / max — Calculate minimum and maximum of the list