Eigene Dateien/FlowVis/src/rancombi.cpp

Go to the documentation of this file.
00001 /************************ RANCOMBI.CPP ****************** AgF 2001-10-18 *
00002 *                                                                        *
00003 *  This file defines a template class for combining two different        *
00004 *  random number generators. A combination of two random number          *
00005 *  generators is generally better than any of the two alone.             *
00006 *  The two generators should preferably be of very different design.     *
00007 *                                                                        *
00008 *  Instructions:                                                         *
00009 *  To make a combined random number generator, insert the class names    *
00010 *  of any two random number generators, as shown in the example below.   *
00011 *                                                                        *
00012 *************************************************************************/
00013 #include "randomc.h"
00014 
00015 // This template class combines two different random number generators
00016 // for improved randomness. R1 and R2 are any two different random number
00017 // generator classes.
00018 
00019 
00020   
00022 /* Example showing how to use the combined random number generator:
00023 #include <stdio.h>
00024 #include <time.h>
00025 #include "randomc.h"
00026 #include "mersenne.cpp"
00027 #include "ranrotw.cpp"
00028 #include "rancombi.cpp"
00029 
00030 int main() {
00031   // Make an object of the template class. The names inside <> define the
00032   // class names of the two random number generators to combine.
00033   // Use time as seed.
00034   TRandomCombined<TRanrotWGenerator,TRandomMersenne> RG(time(0));
00035 
00036   for (int i=0; i<20; i++) {
00037     // generate 20 random floating point numbers and 20 random integers
00038     printf("\n%14.10f   %2i",  RG.Random(),  RG.IRandom(0,99));}
00039 
00040   return 0;}
00041 */

Generated on Mon Jan 21 01:15:16 2008 for FlowVis by  doxygen 1.5.4