love.math.random

love.math.random Available since LÖVE 0.9.0 This function is not supported in earlier versions. Generates a pseudo-random number in a platform independent manner. Function Get uniformly distributed pseudo-random real number within [0, 1]. Synopsis number = love.math.random( ) Arguments None. Returns number number The pseudo-random number. Function Get a uniformly distributed pseudo-random integer within [1, max]. Synopsis number = love.math.random( max ) Arguments number max The max

love.math.noise

love.math.noise Available since LÖVE 0.9.0 This function is not supported in earlier versions. Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments. Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation. There are many webpages which discuss Perlin and Simplex noise in detail. The return value might be constant if only integer arguments are used. Avoid solely passing

love.math.newRandomGenerator

love.math.newRandomGenerator Available since LÖVE 0.9.0 This function is not supported in earlier versions. Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions. Function Synopsis rng = love.math.newRandomGenerator( ) Arguments None Returns RandomGenerator rng The new Random Number Generator object. Function Synopsis rng = love.math.newRandomGenerator( seed ) Arguments number seed The initial seed number to use for

love.math.newBezierCurve

love.math.newBezierCurve Available since LÖVE 0.9.0 This function is not supported in earlier versions. Creates a new BezierCurve object. The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc. Function Synopsis curve = love.math.newBezierCurve( vertices ) Arguments table vertices The vertices of the control polygon as a table in the form of

love.math.linearToGamma

love.math.linearToGamma Available since LÖVE 0.9.1 This function is not supported in earlier versions. Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing. In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-conve

love.math.isConvex

love.math.isConvex Available since LÖVE 0.9.0 This function is not supported in earlier versions. Checks whether a polygon is convex. PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons. Function Synopsis convex = love.math.isConvex( vertices ) Arguments table vertices The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. Returns boolean convex Whether the given polygon is conv

love.math.getRandomSeed

love.math.getRandomSeed Available since LÖVE 0.9.0 This function is not supported in earlier versions. Gets the seed of the random number generator. The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed can be an integer value up to 2^64. Function Synopsis low, high = love.math.getRandomSeed( ) Arguments None. Returns number low Integer number representing the lower 32 bits of the

love.math.gammaToLinear

love.math.gammaToLinear Available since LÖVE 0.9.1 This function is not supported in earlier versions. Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LÖVE doesn't handle conversions automatically. Read more about gamma-correct rendering here, here, and here. Gamma-correct rendering is an advanced topic and it's easy to get color-spaces mixed up. If you're not sur

love.math.decompress

love.math.decompress Available since LÖVE 0.10.0 This function is not supported in earlier versions. Decompresses a CompressedData or previously compressed string or Data object. Function Synopsis rawstring = love.math.decompress( compressedData ) Arguments CompressedData compressedData The compressed data to decompress. Returns string rawstring A string containing the raw decompressed data. Function Synopsis rawstring = love.math.decompress( compressedString, format ) Arguments stri

love.math.compress

love.math.compress Available since LÖVE 0.10.0 This function is not supported in earlier versions. Compresses a string or data using a specific compression algorithm. This function, depending on the compression format and level, can be slow if called repeatedly, such as from love.update or love.draw. Some benchmarks are available here. Function Synopsis compressedData = love.math.compress( rawstring, format, level ) Arguments string rawstring The raw (un-compressed) string to compress. C