Changeset 34
 Timestamp:
 Feb 6, 2004, 10:37:15 AM (19 years ago)
 Location:
 trunk/src
 Files:

 1 deleted
 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/histogram.cc
r13 r34 1 // $Id$ 2 3 #include <cassert> 4 1 5 #include "histogram.h" 2 6 
trunk/src/random_singleton.h
r23 r34 57 57 58 58 @return If \a n is zero, or left out, a number between [ \a 59 min, \a max ] is returned, otherwise a number between 0 and n159 min, \a max ] is returned, otherwise a number between 0 and n1 60 60 is returned. 61 61 … … 144 144 }; // random_singleton 145 145 146 #include "random_singleton.icc" 146 147 double random_singleton::get_exponential( const double& mu ) const 148 { 149 return gsl_ran_exponential( r_, mu ); 150 } 151 152 153 double random_singleton::get_gaussian( const double& sigma ) const 154 { 155 return gsl_ran_gaussian( r_, sigma ); 156 } 157 158 159 inline std::string random_singleton::get_generator_type() const 160 { 161 return static_cast<std::string>( gsl_rng_name( r_ ) ); 162 } 163 164 165 size_t random_singleton::get_rnd_discrete() 166 { 167 return gsl_ran_discrete( r_, gen_ ); 168 } 169 170 171 int random_singleton::get_seed() const 172 { 173 return gsl_rng_default_seed; 174 } 175 176 177 double random_singleton::get_uniform_double() const 178 { 179 return gsl_rng_uniform( r_ ); 180 } 181 182 183 u_long random_singleton::get_uniform_int(const u_long n) const 184 { 185 return ( n ? gsl_rng_uniform_int(r_,n) : gsl_rng_get( r_ )); 186 } 187 188 189 u_long random_singleton::get_uniform_min() const 190 { 191 return gsl_rng_min( r_ ); 192 } 193 194 195 u_long random_singleton::get_uniform_max() const 196 { 197 return gsl_rng_max( r_ ); 198 } 199 200 201 void random_singleton::set_general_distribution_prob( const size_t& k, 202 const double* p ) 203 { 204 gen_ = gsl_ran_discrete_preproc( k, p ); 205 } 147 206 148 207 } // namespace thep_c++_tools
Note: See TracChangeset
for help on using the changeset viewer.