// @(#)root/mathmore:$Id$
// Author: L. Moneta, A. Zsenei   08/2005

 /**********************************************************************
  *                                                                    *
  * Copyright (c) 2004 ROOT Foundation,  CERN/PH-SFT                   *
  *                                                                    *
  * This library is free software; you can redistribute it and/or      *
  * modify it under the terms of the GNU General Public License        *
  * as published by the Free Software Foundation; either version 2     *
  * of the License, or (at your option) any later version.             *
  *                                                                    *
  * This library is distributed in the hope that it will be useful,    *
  * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
  * General Public License for more details.                           *
  *                                                                    *
  * You should have received a copy of the GNU General Public License  *
  * along with this library (see file COPYING); if not, write          *
  * to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
  * 330, Boston, MA 02111-1307 USA, or contact the author.             *
  *                                                                    *
  **********************************************************************/

// Header file for class GSLRandom
//
// Created by: moneta  at Sun Nov 21 16:26:03 2004
//
// Last update: Sun Nov 21 16:26:03 2004
//
#ifndef ROOT_Math_QuasiRandom
#define ROOT_Math_QuasiRandom

#include <string>

/**
   @defgroup QuasiRandom QuasiRandom number generators and distributions
*/



namespace ROOT {
namespace Math {


//_____________________________________________________________________________________
/**
   User class for MathMore random numbers template on the Engine type.
   The API of this class followed that of the class ROOT::Math::Random
   It must be implemented using as Engine one of the derived classes of
   ROOT::Math::GSLQuasiRandomEngine, like ROOT::Math::GSLQrngSobol

   @ingroup Random

*/
template < class Engine>
class QuasiRandom {

public:


   /**
      Create a QuasiRandom generator. Use default engine constructor.
      Engine will  be initialized via Initialize() function in order to
      allocate resources
   */
   QuasiRandom(unsigned int dimension = 1) {
      fEngine.Initialize(dimension);
   }


   /**
      Create a QuasiRandom generator based on a provided generic engine.
      Engine will  be initialized via Initialize() function in order to
      allocate resources
   */
   explicit QuasiRandom(const Engine & e, unsigned int dimension = 1) : fEngine(e) {
      fEngine.Initialize(dimension);
   }

   /**
      Destructor: call Terminate() function of engine to free any
      allocated resource
   */
   ~QuasiRandom() {
      fEngine.Terminate();
   }

   /**
      Generate next quasi random numbers points
   */
   bool Next(double * x) {
      return fEngine(x);
   }

   /**
      Generate next quasi random numbers point (1 - dimension)
   */
   double Next() {
      return fEngine();
   }

   /**
       Generate quasi random numbers between ]0,1[
       0 and 1 are excluded
       Function to be compatible with  ROOT TRandom compatibility
   */
   double Rndm() {
      return fEngine();
   }

   /**
      skip the next n number and jumb directly to the current state + n
   */
   bool Skip(unsigned int n) {
      return fEngine.Skip(n);
   }
   /**
       Generate an array of random numbers between ]0,1[
       Function to preserve ROOT Trandom compatibility
       The array will be filled as   x1,y1,z1,....x2,y2,z2,...
   */
   bool RndmArray(int n, double * array) {
      return fEngine.GenerateArray(array, array+n*NDim());
   }

   /**
      Return the type (name) of the used generator
   */
   std::string Type() const {
      return fEngine.Name();
   }

   /**
      Return the size of the generator state
   */
   unsigned int EngineSize() const {
      return fEngine.Size();
   }

   /**
      Return the dimension of the generator
   */
   unsigned int NDim() const {
      return fEngine.NDim();
   }

   /**
      Return the name of the generator
   */
   std::string Name() const {
      return fEngine.Name();
   }

private:

   Engine fEngine;

};



} // namespace Math
} // namespace ROOT

#ifndef ROOT_Math_GSLQuasiRandom
#include "Math/GSLQuasiRandom.h"
#endif




namespace ROOT {
namespace Math {


typedef QuasiRandom<ROOT::Math::GSLQRngSobol> QuasiRandomSobol;
typedef QuasiRandom<ROOT::Math::GSLQRngNiederreiter2> QuasiRandomNiederreiter;

} // namespace Math
} // namespace ROOT


#endif /* ROOT_Math_QuasiRandom */



 QuasiRandom.h:1
 QuasiRandom.h:2
 QuasiRandom.h:3
 QuasiRandom.h:4
 QuasiRandom.h:5
 QuasiRandom.h:6
 QuasiRandom.h:7
 QuasiRandom.h:8
 QuasiRandom.h:9
 QuasiRandom.h:10
 QuasiRandom.h:11
 QuasiRandom.h:12
 QuasiRandom.h:13
 QuasiRandom.h:14
 QuasiRandom.h:15
 QuasiRandom.h:16
 QuasiRandom.h:17
 QuasiRandom.h:18
 QuasiRandom.h:19
 QuasiRandom.h:20
 QuasiRandom.h:21
 QuasiRandom.h:22
 QuasiRandom.h:23
 QuasiRandom.h:24
 QuasiRandom.h:25
 QuasiRandom.h:26
 QuasiRandom.h:27
 QuasiRandom.h:28
 QuasiRandom.h:29
 QuasiRandom.h:30
 QuasiRandom.h:31
 QuasiRandom.h:32
 QuasiRandom.h:33
 QuasiRandom.h:34
 QuasiRandom.h:35
 QuasiRandom.h:36
 QuasiRandom.h:37
 QuasiRandom.h:38
 QuasiRandom.h:39
 QuasiRandom.h:40
 QuasiRandom.h:41
 QuasiRandom.h:42
 QuasiRandom.h:43
 QuasiRandom.h:44
 QuasiRandom.h:45
 QuasiRandom.h:46
 QuasiRandom.h:47
 QuasiRandom.h:48
 QuasiRandom.h:49
 QuasiRandom.h:50
 QuasiRandom.h:51
 QuasiRandom.h:52
 QuasiRandom.h:53
 QuasiRandom.h:54
 QuasiRandom.h:55
 QuasiRandom.h:56
 QuasiRandom.h:57
 QuasiRandom.h:58
 QuasiRandom.h:59
 QuasiRandom.h:60
 QuasiRandom.h:61
 QuasiRandom.h:62
 QuasiRandom.h:63
 QuasiRandom.h:64
 QuasiRandom.h:65
 QuasiRandom.h:66
 QuasiRandom.h:67
 QuasiRandom.h:68
 QuasiRandom.h:69
 QuasiRandom.h:70
 QuasiRandom.h:71
 QuasiRandom.h:72
 QuasiRandom.h:73
 QuasiRandom.h:74
 QuasiRandom.h:75
 QuasiRandom.h:76
 QuasiRandom.h:77
 QuasiRandom.h:78
 QuasiRandom.h:79
 QuasiRandom.h:80
 QuasiRandom.h:81
 QuasiRandom.h:82
 QuasiRandom.h:83
 QuasiRandom.h:84
 QuasiRandom.h:85
 QuasiRandom.h:86
 QuasiRandom.h:87
 QuasiRandom.h:88
 QuasiRandom.h:89
 QuasiRandom.h:90
 QuasiRandom.h:91
 QuasiRandom.h:92
 QuasiRandom.h:93
 QuasiRandom.h:94
 QuasiRandom.h:95
 QuasiRandom.h:96
 QuasiRandom.h:97
 QuasiRandom.h:98
 QuasiRandom.h:99
 QuasiRandom.h:100
 QuasiRandom.h:101
 QuasiRandom.h:102
 QuasiRandom.h:103
 QuasiRandom.h:104
 QuasiRandom.h:105
 QuasiRandom.h:106
 QuasiRandom.h:107
 QuasiRandom.h:108
 QuasiRandom.h:109
 QuasiRandom.h:110
 QuasiRandom.h:111
 QuasiRandom.h:112
 QuasiRandom.h:113
 QuasiRandom.h:114
 QuasiRandom.h:115
 QuasiRandom.h:116
 QuasiRandom.h:117
 QuasiRandom.h:118
 QuasiRandom.h:119
 QuasiRandom.h:120
 QuasiRandom.h:121
 QuasiRandom.h:122
 QuasiRandom.h:123
 QuasiRandom.h:124
 QuasiRandom.h:125
 QuasiRandom.h:126
 QuasiRandom.h:127
 QuasiRandom.h:128
 QuasiRandom.h:129
 QuasiRandom.h:130
 QuasiRandom.h:131
 QuasiRandom.h:132
 QuasiRandom.h:133
 QuasiRandom.h:134
 QuasiRandom.h:135
 QuasiRandom.h:136
 QuasiRandom.h:137
 QuasiRandom.h:138
 QuasiRandom.h:139
 QuasiRandom.h:140
 QuasiRandom.h:141
 QuasiRandom.h:142
 QuasiRandom.h:143
 QuasiRandom.h:144
 QuasiRandom.h:145
 QuasiRandom.h:146
 QuasiRandom.h:147
 QuasiRandom.h:148
 QuasiRandom.h:149
 QuasiRandom.h:150
 QuasiRandom.h:151
 QuasiRandom.h:152
 QuasiRandom.h:153
 QuasiRandom.h:154
 QuasiRandom.h:155
 QuasiRandom.h:156
 QuasiRandom.h:157
 QuasiRandom.h:158
 QuasiRandom.h:159
 QuasiRandom.h:160
 QuasiRandom.h:161
 QuasiRandom.h:162
 QuasiRandom.h:163
 QuasiRandom.h:164
 QuasiRandom.h:165
 QuasiRandom.h:166
 QuasiRandom.h:167
 QuasiRandom.h:168
 QuasiRandom.h:169
 QuasiRandom.h:170
 QuasiRandom.h:171
 QuasiRandom.h:172
 QuasiRandom.h:173
 QuasiRandom.h:174
 QuasiRandom.h:175
 QuasiRandom.h:176
 QuasiRandom.h:177
 QuasiRandom.h:178
 QuasiRandom.h:179
 QuasiRandom.h:180
 QuasiRandom.h:181
 QuasiRandom.h:182
 QuasiRandom.h:183
 QuasiRandom.h:184
 QuasiRandom.h:185
 QuasiRandom.h:186
 QuasiRandom.h:187