# GSDP:GAM100/CProcessing/noise()

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

# noise()

## Description

Returns a smooth random value from 0.0 to 1.0 based on a three dimensional coordinate.

### Parameters

noise(double x, double y, double z)

• x - (double x) The x coordinate of the random value.
• y - (double y) The y coordinate of the random value.
• z - (double z) The z coordinate of the random value.

## Example

```void update()
{
rectMode(CORNER);
noStroke();
for (int y = 0; y < canvasHeight; y += canvasHeight / Rectangles)
{
for (int x = 0; x < canvasWidth; x += canvasWidth / Rectangles)
{
// get a value between 0 and 255 for our color
// (the smaller the x and the y, the smoother the noise will be)
int grayscale_val = (int)(noise(x*0.01f, y*0.01f, frameCount * 0.1) * 255);

// fill the color our noise generated
fill(color(grayscale_val, grayscale_val, grayscale_val, 255));

// draw the rectangle at the position
rect((float)x, (float)y + 1, (float)canvasWidth / (float)Rectangles, 1 + (float)canvasHeight / (float)Rectangles);
}
}
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.54934376,"math_prob":0.9960803,"size":1280,"snap":"2022-40-2023-06","text_gpt3_token_len":384,"char_repetition_ratio":0.12931034,"word_repetition_ratio":0.13300492,"special_character_ratio":0.325,"punctuation_ratio":0.18218623,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9926077,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-01T21:42:37Z\",\"WARC-Record-ID\":\"<urn:uuid:cd021aad-824e-4a14-8188-69d30a86a202>\",\"Content-Length\":\"25591\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:26a28c5f-96d9-4cb5-a8f8-88e2b3c8f54a>\",\"WARC-Concurrent-To\":\"<urn:uuid:cc8a42a6-bca6-444a-9a1c-3064978954ea>\",\"WARC-IP-Address\":\"204.174.42.104\",\"WARC-Target-URI\":\"https://inside.digipen.edu/index.php?title=GSDP:GAM100/CProcessing/noise()&oldid=58847\",\"WARC-Payload-Digest\":\"sha1:LRXY3W53Z4S5HBF42ZXG53BLUTDKMLNV\",\"WARC-Block-Digest\":\"sha1:KPT2XQU2OKXBTFYJJ3OBSV3WW6C762H4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499953.47_warc_CC-MAIN-20230201211725-20230202001725-00427.warc.gz\"}"}