To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This VI will randomize the order of Input Array elements
Description
This VI is effectively the reverse of the Sort 1D Array VI. it will take the Input Array and randomize the order of its elements. First, the VI initializes an empty array and gets the size of the array input. At every iteration, it will generate a random number and multiply by the array's size, representing an index in the array. If this value is not in the array, insert it. The loop is stopped when the placeholder array has the same number of elements as the input array. Finally, the input array is indexed with the Randomized Array. This is only one possible method to randomize an array's elements.
Requirements
Steps to Implement or Execute Code
1. Manually Initialize the Input Array
2. Run the VI
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
For a better solution, see my comments at the bottom of the page here.