00001 #define WANT_STREAM
00002 #include "include.h"
00003 #include "newran.h"
00004
00005 #ifdef use_namespace
00006 using namespace NEWRAN;
00007 #endif
00008
00009 void test4(int)
00010 {
00011 cout << endl << endl;
00012
00013 {
00014 cout << "Doing permutations" << endl;
00015 RandomPermutation RP;
00016 int i, j;
00017 int p[10];
00018
00019 cout << "... select 10 items from 100...119 without replacement" << endl;
00020 for (i = 1; i <= 10; i++)
00021 {
00022 RP.Next(20,10,p,100);
00023 for (j = 0; j < 10; j++) cout << p[j] << " ";
00024 cout << "\n";
00025 }
00026 cout << "\n";
00027
00028 cout << "... select 10 items from 100...109 without replacement" << endl;
00029 for (i = 1; i <= 10; i++)
00030 {
00031 RP.Next(10,10,p,100);
00032 for (j = 0; j < 10; j++) cout << p[j] << " ";
00033 cout << "\n";
00034 }
00035 cout << "\n";
00036 }
00037
00038 cout << endl << endl;
00039
00040 {
00041 cout << "Doing combinations" << endl;
00042 RandomCombination RC;
00043 int i, j;
00044 int p[10];
00045
00046 cout << "... select 10 items from 100...119 without replacement" << endl;
00047 for (i = 1; i <= 10; i++)
00048 {
00049 RC.Next(20,10,p,100);
00050 for (j = 0; j < 10; j++) cout << p[j] << " ";
00051 cout << "\n";
00052 }
00053 cout << "\n";
00054
00055 cout << "... select 10 items from 100...109 without replacement" << endl;
00056 for (i = 1; i <= 10; i++)
00057 {
00058 RC.Next(10,10,p,100);
00059 for (j = 0; j < 10; j++) cout << p[j] << " ";
00060 cout << "\n";
00061 }
00062 cout << "\n";
00063 }
00064 }
00065
00066