source: Sophya/trunk/SophyaLib/BaseTools/randtmt64.h@ 4078

Last change on this file since 4078 was 4019, checked in by cmv, 14 years ago

ajout generateurs tinymt32+64, cmv 24/09/2011

File size: 1.6 KB
Line 
1#ifndef RANDTMT64_H_SEEN
2#define RANDTMT64_H_SEEN
3
4// Classes TinyMT64RandGen
5// Generateur aleatoire utilisant le code TinyMT 64 bits
6//
7// R. Ansari (C) UPS+LAL IN2P3/CNRS 2009
8// C. Magneville (C) DAPNIA/SPP CEA 2009
9
10
11#include "machdefs.h"
12#include "objfio.h"
13
14#include "randinterf.h"
15
16#include <vector>
17
18//--- Declaration de la struct definie ds tinymt64.h - inclus uniquement dans le .cc
19struct TINYMT64_T ;
20typedef struct TINYMT64_T tinymt64_t;
21//-------------------
22
23namespace SOPHYA {
24
25//! Pseudorandom number generator class using dSFMT code
26class TinyMT64RandGen : public RandomGeneratorInterface {
27
28 public:
29 TinyMT64RandGen(uint_8 seed=12345);
30 virtual ~TinyMT64RandGen();
31
32 virtual void SetSeed(uint_8 seed);
33 virtual void SetSeed(vector<uint_8> seed);
34 virtual void AutoInit(int lp=0);
35 virtual void ShowRandom();
36
37 friend class ObjFileIO<TinyMT64RandGen> ;
38
39 protected:
40 virtual r_8 Next();
41 tinymt64_t* tinymt64_ptr_; // Pointeur car tinymt64_t pas encore defini
42
43};
44
45// Classe pour la gestion de persistance PPF : ObjFileIO<TinyMT64RandGen>
46
47/*! Writes the random generator object state in the POutPersist stream \b os */
48inline POutPersist& operator << (POutPersist& os, TinyMT64RandGen & obj)
49{ ObjFileIO<TinyMT64RandGen> fio(&obj); fio.Write(os); return(os); }
50/*! Reads the random generator object state from the PInPersist stream \b is */
51inline PInPersist& operator >> (PInPersist& is, TinyMT64RandGen & obj)
52{ ObjFileIO<TinyMT64RandGen> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
53
54} /* namespace SOPHYA */
55
56#endif
Note: See TracBrowser for help on using the repository browser.