#include <newran.h>
Inheritance diagram for RandomCombination:


Public Member Functions | |
| void | Next (int N, int M, int p[], int start=0) |
| void | Next (int N, int p[], int start=0) |
Private Member Functions | |
| void | SortAscending (int n, int gm[]) |
|
||||||||||||||||
|
Reimplemented from RandomPermutation. Definition at line 668 of file newran.h.
00668 { Next(N, N, p, start); }
|
|
||||||||||||||||||||
|
Reimplemented from RandomPermutation. Definition at line 666 of file newran.h. References Ars::Graf::M, RandomPermutation::Next(), and SortAscending(). Referenced by test4().
00667 { RandomPermutation::Next(N, M, p, start); SortAscending(M, p); }
|
|
||||||||||||
|
Definition at line 944 of file newran.cpp.
00945 {
00946 // from numerical recipies in C - Shell sort
00947
00948 const double aln2i = 1.442695022; const double tiny = 1.0e-5;
00949 int m = n; int lognb2 = (int)(aln2i * log((double)n) + tiny);
00950 while (lognb2--)
00951 {
00952 m >>= 1;
00953 for (int j = m; j<n; j++)
00954 {
00955 int* gmj = gm+j; int i = j-m; int* gmi = gmj-m; int t = *gmj;
00956 while (i>=0 && *gmi>t) { *gmj = *gmi; gmj = gmi; gmi -= m; i -= m; }
00957 *gmj = t;
00958 }
00959 }
00960 }
|
1.3.3