To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This code illustrates the easiest way of shuffling an array of strings.
Description
The intend of this VI is to shuffle an array of strings, which in this case, it represents a musical play list. To make it more fun, the songs listed have been NI-fied. The names were taken from well-known tunes and forced it to fit some of National Instruments' products.
Please do note that there is a “randomize factor” constant on the block diagram. It is currently set to 1, but this can be increased to improve the shuffle. Also, note that if you scroll to the right on the front panel, there is a Boolean array which informs you how many tracks are in their original positions – allowing you to rate the efficiency of the shuffle.
Requirements
LabVIEW Base Development System (or compatible)
Steps to Implement or Execute Code
1. Run the VI
Additional Information or References
**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.
There are better ways to shuffle an array, see http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Randomize-Array/idi-p/1158907