source: cpp/frams/util/rndutil.h @ 156

Last change on this file since 156 was 121, checked in by sz, 11 years ago

updated file headers and makefiles

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// This file is a part of the Framsticks GDK.
2// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#ifndef _RNDUTIL_H_
6#define _RNDUTIL_H_
7
8#include <common/nonstd.h>
9#include "math.h"
10
11/** @file rndutil.h various functions */
12
13/** @param x change seed if x<=0
14    @return random value [0..x-1] if x>0 */
15unsigned short pseudornd(short x);
16
17double CustomRnd(double*);
18// the parameter is a table which describes the random distribution:
19// e.g.
20// double x[]={ 3,     // 3 intervals
21//  -10,-1,            // (each of them has always uniform distribution and equal probability of being selected)
22//  -1, 1,
23//   1,10, };
24
25class RandomGener
26{
27   public:
28      RandomGener() {isNextGauss=0;}
29      static double Uni(double begin, double end); ///< uniform excluding 'end' boundary
30      double GaussStd();
31      double Gauss(double m,double s); ///< usually will not return further than 5*stdd
32   private:
33      int isNextGauss;
34      double nextGauss;
35};
36
37extern RandomGener RndGen;
38
39#endif
Note: See TracBrowser for help on using the repository browser.