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

Last change on this file since 1279 was 793, checked in by Maciej Komosinski, 6 years ago

Code formatting

  • Property svn:eol-style set to native
File size: 1.0 KB
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
[121]4
[109]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
[793]14        @return random value [0..x-1] if x>0 */
[109]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{
[793]27public:
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
32private:
33        int isNextGauss;
34        double nextGauss;
[109]35};
36
37extern RandomGener RndGen;
38
39#endif
Note: See TracBrowser for help on using the repository browser.