00001 // @(#)root/unuran:$Id: UnuranRng.h 30749 2009-10-15 16:33:04Z brun $ 00002 // Author: L. Moneta Wed Sep 27 11:22:34 2006 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT * 00007 * * 00008 * * 00009 **********************************************************************/ 00010 00011 // Header file for class UnuranRng 00012 00013 #ifndef ROOT_UnuranRng 00014 #define ROOT_UnuranRng 00015 00016 00017 /** 00018 UnuranRng class for interface ROOT random generators to Unuran 00019 */ 00020 00021 template<class Random> 00022 struct UnuranRng { 00023 00024 public: 00025 00026 /// function to delete object (not needed) 00027 static void Delete(void * /* p */ ) { 00028 // Random * r = reinterpret_cast<Random *> (p); 00029 // delete r; 00030 } 00031 00032 /// function to set the seed in the random 00033 static void Seed(void * p, unsigned long seed) { 00034 Random * r = reinterpret_cast<Random *> (p); 00035 r->SetSeed(seed); 00036 } 00037 00038 /// function to sample random generator 00039 static double Rndm(void * p) { 00040 Random * r = reinterpret_cast<Random *> (p); 00041 return r->Rndm(); 00042 } 00043 00044 00045 }; 00046 00047 00048 00049 #endif /* ROOT_UnuranRng */