# New to Processing and need a little help

**URL:** <https://discourse.processing.org/t/new-to-processing-and-need-a-little-help/2616>\
**Category:** Processing\
**Created:** [August 13, 2018, 5:22pm UTC](https://discourse.processing.org/t/new-to-processing-and-need-a-little-help/2616 "2018-08-13T17:22:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yxzageo](https://avatars.discourse-cdn.com/v4/letter/y/ccd318/32.png) [@yxzageo](https://discourse.processing.org/u/yxzageo)\
**Post date:** [August 13, 2018, 5:22pm UTC](https://discourse.processing.org/t/new-to-processing-and-need-a-little-help/2616/1 "2018-08-13T17:22:06Z")

</div>

Hello, I’m running a program that someone else written. It runs smoothly but I want to understand what the code does.  
I have the following snippet:  
for (int i = n-1; i \> 0; i–) {  
int j = rand()%(i+1);  
image.pixels[j]^=image.pixels[i];  
image.pixels[i]^=image.pixels[j];  
image.pixels[j]^=image.pixels[i];  
}  
what does the “^=” mean? I haven’t found that in the Reference.  
Regards  
Hans

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [August 13, 2018, 5:29pm UTC](https://discourse.processing.org/t/new-to-processing-and-need-a-little-help/2616/2 "2018-08-13T17:29:48Z")

</div>

That’s a **bitwise operator**. Specifically it’s a **bitwise XOR operator**.

There’s also a reassignment operator in there, so this line:

```
image.pixels[j] ^= image.pixels[i];

```

Is really doing this:

```
image.pixels[j] = image.pixels[j] ^ image.pixels[i];

```

There are a ton of resources on google, but basically, bitwise operators are like the operators you’re used to (`+` or `-` for example) but they work on the binary representation of the numbers you’re using.

[This page](https://www.tutorialspoint.com/java/java_basic_operators.htm) has a pretty good explanation of bitwise operators.

---

<div class="post-metadata">

**Author:** ![yxzageo](https://avatars.discourse-cdn.com/v4/letter/y/ccd318/32.png) [@yxzageo](https://discourse.processing.org/u/yxzageo)\
**Post date:** [August 13, 2018, 5:59pm UTC](https://discourse.processing.org/t/new-to-processing-and-need-a-little-help/2616/3 "2018-08-13T17:59:10Z")

</div>

Thanks a lot for a quick and understandable response.

Hans
