# [name]

An object with several math utility functions.

## Functions

### [method:Float clamp]( [param:Float value], [param:Float min], [param:Float max] )

[page:Float value] — Value to be clamped.
[page:Float min] — Minimum value.
[page:Float max] — Maximum value.
Clamps the [page:Float value] to be between [page:Float min] and [page:Float max].

### [method:Float degToRad]( [param:Float degrees] )

Converts degrees to radians.

### [method:Integer euclideanModulo]( [param:Integer n], [param:Integer m] )

[page:Integer n], [page:Integer m] - Integers
Computes the Euclidean modulo of [page:Integer m] % [page:Integer n], that is: `( ( n % m ) + m ) % m`

### [method:UUID generateUUID]( )

Generate a [link:https://en.wikipedia.org/wiki/Universally_unique_identifier UUID] (universally unique identifier).

### [method:Boolean isPowerOfTwo]( [param:Number n] )

Return *true* if [page:Number n] is a power of 2.

### [method:Float lerp]( [param:Float x], [param:Float y], [param:Float t] )

[page:Float x] - Start point.
[page:Float y] - End point.
[page:Float t] - interpolation factor in the closed interval [0, 1].
Returns a value [link:https://en.wikipedia.org/wiki/Linear_interpolation linearly interpolated] from two known points based on the given interval - [page:Float t] = 0 will return [page:Float x] and [page:Float t] = 1 will return [page:Float y].

### [method:Float mapLinear]( [param:Float x], [param:Float a1], [param:Float a2], [param:Float b1], [param:Float b2] )

[page:Float x] — Value to be mapped.
[page:Float a1] — Minimum value for range A.
[page:Float a2] — Maximum value for range A.
[page:Float b1] — Minimum value for range B.
[page:Float b2] — Maximum value for range B.
Linear mapping of [page:Float x] from range [[page:Float a1], [page:Float a2]] to range [[page:Float b1], [page:Float b2]].

### [method:Integer ceilPowerOfTwo]( [param:Number n] )

Returns the smallest power of 2 that is greater than or equal to [page:Number n].

### [method:Integer floorPowerOfTwo]( [param:Number n] )

Returns the largest power of 2 that is less than or equal to [page:Number n].

### [method:Float radToDeg]( [param:Float radians] )

Converts radians to degrees.

### [method:Float randFloat]( [param:Float low], [param:Float high] )

Random float in the interval [page:Float low] to [page:Float high].

### [method:Float randFloatSpread]( [param:Float range] )

Random float in the interval *- [page:Float range] / 2* to *[page:Float range] / 2*.

### [method:Integer randInt]( [param:Integer low], [param:Integer high] )

Random integer in the interval [page:Float low] to [page:Float high].

### [method:Float smoothstep]( [param:Float x], [param:Float min], [param:Float max] )

[page:Float x] - The value to evaluate based on its position between min and max.
[page:Float min] - Any x value below min will be 0.
[page:Float max] - Any x value above max will be 1.
Returns a value between 0-1 that represents the percentage that x has moved between min and max, but smoothed or slowed down the closer X is to the min and max.
See [link:http://en.wikipedia.org/wiki/Smoothstep Smoothstep] for details.

### [method:Float smootherstep]( [param:Float x], [param:Float min], [param:Float max] )

[page:Float x] - The value to evaluate based on its position between min and max.
[page:Float min] - Any x value below min will be 0.
[page:Float max] - Any x value above max will be 1.
Returns a value between 0-1. A [link:https://en.wikipedia.org/wiki/Smoothstep#Variations variation on smoothstep] that has zero 1st and 2nd order derivatives at x=0 and x=1.

## Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]