# Get() returns an empty pixels array

**URL:** <https://discourse.processing.org/t/get-returns-an-empty-pixels-array/31132>\
**Category:** Coding Questions\
**Created:** [July 9, 2021, 8:35am UTC](https://discourse.processing.org/t/get-returns-an-empty-pixels-array/31132 "2021-07-09T08:35:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![k5221](https://avatars.discourse-cdn.com/v4/letter/k/bbe5ce/32.png) [@k5221](https://discourse.processing.org/u/k5221)\
**Post date:** [July 11, 2021, 5:11am UTC](https://discourse.processing.org/t/get-returns-an-empty-pixels-array/31132/3 "2021-07-11T05:11:54Z")

</div>

Hello @javagar, thank you so much for your help!  
I have pixelShuffle function here by modifying a random sort algorithm, but it doesn’t seem to be working (looks like it just returns the original image). If possible, could you look at this?

```auto
function pixelShuffle(pixels) {
  pixels.loadPixels();
  for(var i = (pixels.length - 1); 0 < i; i -= 4){

    var r = Math.floor(Math.random() * (i + 1));
    var arr1 = pixels.splice(r, 4);
    var arr2 = pixels.splice(i, 4);
    pixels = pixels.concat(arr1);
    Array.prototype.splice.apply(pixels, [r, 0].concat(arr2));
  }
  pixels.updatePixels();
  return pixels;
}

```

---

_[View the full topic](https://discourse.processing.org/t/get-returns-an-empty-pixels-array/31132)._
