Jump to content

Shuffle a 1D, or 2D array


Tvern
 Share

Recommended Posts

I recently needed to "shuffle" the rows in an array and was surprised to find there was no function for this in array.au3.

A search on the forum returned This method by Yashied.

* I've eliminated the need for multiple passes by switching each index with a random one at least once in one pass, making it much faster.

* I've allowed for sorting 2D arrays, although only the row index is changed. The content and column order of the rows stays the same.

I hope someone finds this helpfull, or suggestions and improvements are welcome. :(

I've used _ArraySort() by Jos van der Zande as a template for the description and errorchecking as this is the first UDF I've posted here. Hope it's ok.

_ArrayRandom.au3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...