source: cpp/geno_fx/rndutil.h @ 3

Last change on this file since 3 was 3, checked in by Maciej Komosinski, 16 years ago

added geno_fx, a base class for genetic operations on genotypes

File size: 909 bytes
Line 
1#ifndef _RNDUTIL_H_
2#define _RNDUTIL_H_
3
4#include "nonstd.h"
5#include "math.h"
6
7/** @file rndutil.h various functions */
8
9/** @param x change seed if x<=0
10    @return random value [0..x-1] if x>0 */
11unsigned short pseudornd(short x);
12
13double CustomRnd(double*);
14// the parameter is a table which describes the random distribution:
15// e.g.
16// double x[]={ 3,     // 3 intervals
17//  -10,-1,            // (each of them has always uniform distribution and equal probability of being selected)
18//  -1, 1,
19//   1,10, };
20
21class RandomGener
22{
23   public:
24      RandomGener() {isNextGauss=0;}
25      static double Uni(float pocz, float kon); ///< unform excluding boundaries
26      double GaussStd();
27      double Gauss(float m,float s); ///< usually will not return further than 5*stdd
28   private:
29      int isNextGauss;
30      double nextGauss;
31};
32
33extern RandomGener RndGen;
34
35#endif
Note: See TracBrowser for help on using the repository browser.