# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `RGB`::`random`

Pick a color uniformly at random in RGB color space

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```RGB::random()
```

## Description

`RGB::random()` returns a random color. The colors returned are distributed independently and uniformly in the RGB color space.

## Examples

### Example 1

`RGB::random` can be used to produce high-frequency noise:

`plot(plot::Raster([[RGB::random() \$ x = 0..42] \$ y = 0..42]))`

### Example 2

It is possible to use `RGB::random` directly as a color function, but the result may be unexpected:

`plot(plot::Waterman(5, FillColorFunction = RGB::random))`

The reason is that the color function will be called repeatedly if the same point is met again. It is a better idea to create a bunch of random colors and then use the parameters passed into the color functions to get some consistency into the choice of colors:

```colors := [RGB::random() \$ i = 1..42]: plot(plot::Waterman(5, FillColorFunction=((x,y,z,i) -> colors[i])))```

## Return Values

RGB color: A list of three floating-point values.