16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 16:19:19 +02:00

Poprawki post-merge. Nowy silnik liczb losowych.

Dodane zagubione pliki
This commit is contained in:
firleju
2017-01-25 16:25:25 +01:00
parent 28e85e8dc3
commit 4ad5ac1b51
9 changed files with 21 additions and 15 deletions

View File

@@ -13,6 +13,7 @@ Copyright (C) 2007-2014 Maciej Cierniak
*/
#include "stdafx.h"
#include "mctools.h"
#include "Globals.h"
/*================================================*/
@@ -133,6 +134,12 @@ bool UnSetFlag(int &Flag, int Value)
return true;
}
inline double Random(double a, double b)
{
std::uniform_real_distribution<> dis(a, b);
return dis(Global::random_engine);
}
bool FuzzyLogic(double Test, double Threshold, double Probability)
{
if ((Test > Threshold) && (!DebugModeFlag))
@@ -458,7 +465,7 @@ void ComputeArc(double X0, double Y0, double Xn, double Yn, double R, double L,
{
double dX;
double dY;
double Xc;
double Xc;
double Yc;
double gamma;
double alfa;

View File

@@ -68,16 +68,11 @@ inline long Round(float f)
//return lround(f);
}
inline int Random()
{
std::srand(std::time(NULL));
return std::rand();
}
extern double Random(double a, double b);
inline double Random(double a, double b)
inline double Random()
{
std::srand(std::time(NULL));
return a + std::rand() / (float)RAND_MAX * (b - a);
return Random(0.0,1.0);
}
inline double Random(double b)