Shuffle (Sripts)
- Downloads:
- Views:
- Rating:

Shuffle - Random permutation of array elements
This function is equivalent to X(RANDPERM(LENGTH(X)), but 50% to 85% faster. It uses D.E. Knuth's shuffle algorithm (also called Fisher-Yates) and the cute KISS random number generator (G. Marsaglia). While RANDPERM needs 2*LENGTH(X)*8 bytes as temporary memory, SHUFFLE needs just a fixed small number of bytes.
1. Inplace shuffling: Y = Shuffle(X, Dim)
INPUT:
X: DOUBLE, SINGLE, CHAR, LOGICAL, (U)INT64/32/16/8 array.
Dim: Dimension to operate on. Optional, default: 1st non-singleton dimension.
OUTPUT:
Y: Array of same type and size as X with shuffled elements.
2. Create a shuffle index: Index = Shuffle(N, 'index', NOut)
This is equivalent to Matlab's RANDPERM, but much faster, if N is large and NOut is small.
INPUT:
N: Integer number.
NOut: The number of output elements. Optional, default: N.
OUTPUT:
Index: [1:NOut] elements of shuffled [1:N] vector in the smallest possible integer type.
3. Derangement index:
Index = Shuffle(N, 'derange', NOut)
Equivalent to the index method, but all Index[i] ~= i. A rejection method is used: Create an index vector until a derangement is gained.
EXAMPLES:
R = Shuffle(1:8) % [8, 1, 2, 6, 4, 3, 5, 7]
R = Shuffle('abcdefg') % 'efbadcg'
R = Shuffle([1:4; 5:8], 2) % [3, 2, 1, 4; 6, 8, 7, 5]
I = Shuffle(8, 'index'); % UINT8([1, 5, 7, 6, 2, 3, 4, 8])
Choose 10 different rows from a 1000 x 100 matrix:
X = rand(1000, 100); Y = X(Shuffle(1000, 'index', 10), :);
Operate on cells or complex arrays:
C = {9, 's', 1:5}; SC = C(Shuffle(numel(C), 'index'));
M = rand(3) + i * rand(3); SM = M(:, Shuffle(size(C, 2), 'index'))
NOTES: There are several other shuffle functions in the FEX. Some use Knuth's method also, some call RANDPERM. This implementation is faster due to calling a compiled MEX file and it has a smaller memory footprint. The KISS random numbers are much better than the RAND() of the C-standard libs.
Run the unit-test TestShuffle to test validity and speed (see screenshot).
Tested: Matlab 6.5, 7.7, 7.8, 32bit, WinXP,
Compiler: LCC 2.4/3.8, BCC 5.5, Open Watcom 1.8, MSVC 2008.
Compatibility to 64 bit, Linux and Mac is assumed.
Pre-compiled Mex: http://www.n-simon.de/mex
Free download from Shareware Connection - Shuffle - Random permutation of array elements
Version: 1.0 | Size: 20 KB | Platform: Matlab, Scripts
Released Date: 07-01-2013 | Rating: 0 | Title: Shuffle (Sripts)
Author Url: http://www.mathworks.com
Program Info Url: http://www.mathworks.com
Download Url: http://www.mathworks.com/matlabcentral/fx_files/27076/5/Shuffle_07Mar2011.zip
ScaleTime - ScaleTime - fast linear matrix interpolation
DateStr2Num - DATESTR2NUM - Fast conversion of DATESTR to DATENUM
strncmpr - Compare last N chars of strings or cell strings
Patch FILTFILT - If applied to a matrix, the function FILTFILT (Signal Processing Toolbox) calls itself recursively for each column.
fSGolayFilt - fSGolayFilt is a fast polynomial smoothing filter for uniformly spaced signals
SimpleTest
WordPress Auto Poster Plugin
Professional Simulink Audio Equalizer
PHP Print / Echo
Ends Smart Form
Output buffering, and how it can change your life
ScriptCase - PHP Code Generator
Advanced Istaller for Java
FORMfields - The PHP Framework
C to C++ Converter
C++ Compiler
Wind Turbine Model
RTFGen - the PHP RTF generator
Cumulative Mann-Kendall trend test
Affiliate Programs
Animation
Auctions
Audio Systems
Banner Rotation
Blog
Bulletin Boards & Forums
Business & Enterprise
Buttons
Calendars & Events
Charts & Graphs
Chat
Classified Ad Managers
Communication
Shuffle Cupid
Shuffle L Cupid
Shuffle V Cupid
Shuffle Puck
Cd Wrote Shuffle
Free DivX to iPod shuffle Fast - Free DivX to iPod shuffle Fast helps its users free convert DivX file to iPod shuffle format. It has a user-friendly interface, and provide you the easiest way to do your conversion. The output quality is great and conversion speed is fast.
Free WMA to iPod shuffle SE - Free WMA to iPod shuffle SE is a totally free conversion program. It can help you to convert WMA to iPod shuffle format with fast speed and high quality. With a user-friendly interface, it is easy to use for all its users.
Free AAC to iPod shuffle Converter - From the name: Free AAC to iPod shuffle Converter, we know that its focused aim is to convert AAC to iPod shuffle and it's free, totally free. It can convert superfast, however, you do not need to worry about the output quality.
Free FLAC 2 iPod shuffle Lite - Free FLAC 2 iPod shuffle Lite is good. First, it's free. Second, it's a professional and easy-to-use program for converting FLAC to iPod shuffle fast with wonderful output quality. Third, there is no viruse, malware, etc. Safe to install.
Free RM 2 iPod shuffle Lite - Free RM 2 iPod shuffle Lite is good. First, it's free. Second, it's a professional and easy-to-use program for converting RM to iPod shuffle fast with wonderful output quality. Third, there is no viruse, malware, etc. Safe to install.
Shareware Connection periodically updates pricing and software information of 'Shuffle (Sripts)' from company source 'Jan Simon' , so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using 'Shuffle (Sripts)' crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Shuffle (Sripts).
TuckAway Intelligent Email Organizer Pro - Using an email software allow you to do a number of things including managing your address lists, emails and even ending memos, documents and even virtual letters. You can also use it to manage your tasks easily. The email software comes in ...
Voila - Mac users have never felt much hassle as far as image editing goes, given the fact Apple itself offers two compelling image editing suites. However, serious users may find the inbuilt screen capturing options basic, the fact they are much ahead ...
Adobe SpeedGrade - Adobe has been a long time player in video editing and post production sector, with apps like Premier Pro and AfterEffects winning accolades and keeping customers hooked for several years. To cater to a niche section of the target users, it has ...
Autodesk Smoke - Autodesk is the company well known for making some of the most feature rich and versatile tools for 3D modeling, animation and engineering design related work. Its Smoke is a Mac OS specific app that is aimed at professionals involved in ...
Freemake Video Converter - Video conversion can become a necessity for average PC users who find it increasingly hard to manage an ever growing collection of media and video files. The DVDs, videos obtained from web and clips shot with mobile devices keep growing. Over ...
CCleaner Network Edition - Keeping computers clean of redundant and junk data is a prerequisite and these are various methods to do that. Apart from integrated utilities that come with Windows, you can also use third party utilities to keep PC clean of junk files and ...
MacCleanse - Macs are known for their multitasking prowess and near perfect performance over other type of computers. However, after prolonged usage a Mac can also run slower than usual. In such situations, you can try third party clean up and maintenance ...
Video Editor - With advancements in both computer software and hardware, average users are getting into activities that were hitherto reserved for professionals. There are several video editing tools aimed at casual users as well. While professional users ...
Tiranium Premium Security 2014 - Antivirus or Internet security software has become a mandatory requirement for computer users, including casual users and network administrators. However, it is quite commonplace for average PC users to get a little confused when selecting a ...
DVDFab DVD Copy - While a lot of computer users are switching from optical media to external and cloud storage services, a section of them still counts on DVD for storage and movie watching. At times it also becomes necessary to copy those DVDs that are getting ...
