Example Code

Generate Randomized Array of Strings (Configurable Probability) using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

When provided with an array of strings and a corresponding array of numerics (which designates the probability that the string at the same index of the paired array will be "selected"), this VI returns a randomized array of the elements given. 

 

Description

This VI returns a randomized array of the elements given.  It does this by normalizing the probability values provided and comparing them to a random value between 0 and 1.

 

Requirements

  • LabVIEW 2012( (or compatible)


Steps to Implement or Execute Code

  1. Run the VI

 

 Additional Information or References

Front Panel

StringRandomizerFP.png

 

Block Diagram

StringRandomizerBD.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.** 

Tom L.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.