# \[Help\] Add random flicker to pixel sorting

**URL:** <https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299>\
**Category:** Coding Questions\
**Created:** [May 26, 2021, 5:54am UTC](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299 "2021-05-26T05:54:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwe2000](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@cwe2000](https://discourse.processing.org/u/cwe2000)\
**Post date:** [May 26, 2021, 5:54am UTC](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299/1 "2021-05-26T05:54:09Z")

</div>

Hey so I’m attempting to add a random flicker to the rendered image having the script select two random values for the pixel sort and have it flick between them. Potentially saving as a GIF or video.

> **[kimasendorf/ASDFPixelSort](https://github.com/kimasendorf/ASDFPixelSort)**
>
> Processing script to sort portions of pixels in an image.

Here is the script I’m working with

Any help would be appreciated

Cheers

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [May 26, 2021, 8:24pm UTC](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299/2 "2021-05-26T20:24:58Z")

</div>

Hi @cwe2000 ,

Welcome to the forum! 😉

What is your actual issue? What is not working? What have you tried so far?

---

<div class="post-metadata">

**Author:** ![cwe2000](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@cwe2000](https://discourse.processing.org/u/cwe2000)\
**Post date:** [May 28, 2021, 8:55am UTC](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299/3 "2021-05-28T08:55:12Z")

</div>

This sounds very amateur since I don’t really know what I’m doing. So I’ve figured out how to generate a random variable for the brightness value, which was my original problem. But I want to know how to have it generate x amount of images each with a new random value, and have them export to a gif or video.

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [May 28, 2021, 9:20am UTC](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299/4 "2021-05-28T09:20:27Z")

</div>

ok, can you at least post a working code so we can see what’s going on? 😉

From what you said, you can check the documentation for the following functions :

- [`PImage`](https://processing.org/reference/PImage.html)
- [`save()`](https://processing.org/reference/save_.html)
- [`random()`](https://processing.org/reference/random_.html)
- [https://processing.org/tutorials/pixels](https://processing.org/tutorials/pixels)
