Jump to content

[CR] Random permutation

Recommended Posts


File Name: Random permutation

File Submitter: LAVA 1.0 Content

File Submitted: 02 Jul 2009

File Updated: 02 Jul 2009

File Category: General

LabVIEW Version: 8.2

File Version: 2.0.0

License Type: Creative Commons Attribution 3.0

Potentially make this file available on the VI Package Network?: Undecided

Copyright © 2006, 2007, Syrus Nemat-Nasser

All rights reserved.


Syrus Nemat-Nasser

**see readme text for email address**


This SubVI takes a positive I32 integer n as input and generates a uniformly random array of the integers from 0 to n-1 as output. It is equivalent in function to the ‘randperm’ command in MATLAB. If a non-positive value is provided, an error is raised to alert the caller.

Version History:


Initial release of the code.


Added input validation, error handling, and the option to use "MATLAB mode" and generate a permutation of the integers from 1 to n instead of 0 to n-1, where n is the value wired to the size input. Added a "convert to I32" before feeding the random index to the array functions to eliminate two coercion dots. Updated description to reflect these changes. Changed wiring pattern to 4-2-2-4 and changed icon to accomodate additional terminals.


Added a random seed input to allow the user to optionally seed the random number generator to produce a specific random permutation. The VI now uses the Uniform White Noise PtByPt function which is not available in the LabVIEW Base package. Users who have the Base package may need to use version 1.1.0 which is still included in the distribution.

Click here to download this file

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.