Code covered by the BSD License  

Highlights from
Matgraph

from Matgraph by Ed Scheinerman
Toolbox for working with simple, undirected graphs

Description of random
Home > matgraph > @permutation > random.m

random

PURPOSE ^

random(p) --- return a random reordering of the elements of p

SYNOPSIS ^

function q = random(p)

DESCRIPTION ^

 random(p) --- return a random reordering of the elements of p

CROSS-REFERENCE INFORMATION ^

This function calls:
  • length length(p) gives the size of the permutation
  • permutation constructor for the permutation class
This function is called by:

SOURCE CODE ^

0001 function q = random(p)
0002 % random(p) --- return a random reordering of the elements of p
0003 a = randperm(length(p));
0004 q = permutation(a);

Generated on Thu 13-Mar-2008 14:23:52 by m2html © 2003

Contact us at files@mathworks.com