[LON-CAPA-users] tables, matching problems

Gerd Kortemeyer lon-capa-users@mail.lon-capa.org
Fri, 11 Feb 2005 17:28:02 -0500


Quoting Guy Albertelli II <guy@albertelli.com>:
>  $seed=&random(1,1000000,1);
>  @foils=&random_permutation($seed,@foils);
>  @graph=&random_permutation($seed,@graph);

Using the built-in &random_permutation-function is of course much more elegant
than my pedestrian permutation algorithm:

> for ($i=1;$i<=3;$i++) {
>     $i1=&random(0,3,1);
>     $i2=&random(0,3,1);
>     $f=$files[$i1];
>     $v=$vals[$i1];
>     $files[$i1]=$files[$i2];
>     $vals[$i1]=$vals[$i2];
>     $files[$i2]=$f;
>     $vals[$i2]=$v;
>}

Live and learn ...

- Gerd.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.