-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the Random functions into the engine
- Loading branch information
Showing
5 changed files
with
49 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Created by Robin on 01/01/2018. | ||
// | ||
|
||
#include "Random.h" | ||
#include <random> | ||
|
||
float WolfEngine::RandomRange(float min, float max) | ||
{ | ||
std::random_device rd; | ||
std::mt19937 eng(rd()); | ||
std::uniform_real_distribution<float> distribution(min, max); | ||
return distribution(eng); | ||
} | ||
|
||
double WolfEngine::RandomRange(double min, double max) | ||
{ | ||
std::random_device rd; | ||
std::mt19937 eng(rd()); | ||
std::uniform_real_distribution<double> distribution(min, max); | ||
return distribution(eng); | ||
} | ||
|
||
int WolfEngine::RandomRange(int min, int max) | ||
{ | ||
std::random_device rd; | ||
std::mt19937 eng(rd()); | ||
std::uniform_int_distribution<int> distribution(min, max); | ||
return distribution(eng); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Created by Robin on 01/01/2018. | ||
// | ||
|
||
#pragma once | ||
|
||
namespace WolfEngine | ||
{ | ||
float RandomRange(float min, float max); | ||
double RandomRange(double min, double max); | ||
int RandomRange(int min, int max); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters