---
name: "math"
section: "3caca"
platform: "linux"
package: "libcaca-dev"
version: "0.9-4"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/math/3caca"
---

# math(3caca)

## NAME

Mathematical functions -

### Functions

int **caca\_rand** (int, int)\
 *Generate a random integer within a range.*  unsigned int **caca\_sqrt** (unsigned int)\
 *Approximate a square root, using Newton's method to avoid costly floating point calculations.*

## Detailed Description

These functions provide a few useful math-related routines.

## Function Documentation

### int caca\_rand (int min, int max)

**Parameters:**

*min* The lower bound of the integer range. \
 *max* The upper bound of the integer range.

**Returns:**

A random integer comprised between `min` and `max`, inclusive.

### unsigned int caca\_sqrt (unsigned int a)

**Parameters:**

*a* A positive integer.

**Returns:**

The approximate square root of `a`.
