mirror of
https://github.com/Relintai/programming_tutorials.git
synced 2025-04-21 21:51:22 +02:00
Fix a few issues with the math class.
This commit is contained in:
parent
30c5a82381
commit
88e26a6478
@ -147,9 +147,9 @@ UML:
|
||||
| + seed(s : unsigned int) { static } | -> srand(s);
|
||||
| + randomize() { static } | -> srand(time(NULL));
|
||||
| |
|
||||
| + rand() : int { static } | -> return rand();
|
||||
| + randf() : float { static } | -> return rand() / static_cast<float>(RANDOM_32BIT_MAX);
|
||||
| + randd() : double { static } | -> return rand() / static_cast<double>(RANDOM_32BIT_MAX);
|
||||
| + rand() : int { static } | -> return ::rand();
|
||||
| + randf() : float { static } | -> return ::rand() / static_cast<float>(RANDOM_32BIT_MAX);
|
||||
| + randd() : double { static } | -> return ::rand() / static_cast<double>(RANDOM_32BIT_MAX);
|
||||
| |
|
||||
| + rand(int m) : int { static } | -> return rand() % m;
|
||||
| |
|
||||
|
@ -44,22 +44,22 @@ void Math::randomize() {
|
||||
}
|
||||
|
||||
int Math::rand() {
|
||||
return rand();
|
||||
return ::rand();
|
||||
}
|
||||
|
||||
float Math::randf() {
|
||||
return rand() / static_cast<float>(RANDOM_32BIT_MAX);
|
||||
return ::rand() / static_cast<float>(RANDOM_32BIT_MAX);
|
||||
}
|
||||
|
||||
double Math::randd() {
|
||||
return rand() / static_cast<double>(RANDOM_32BIT_MAX);
|
||||
return ::rand() / static_cast<double>(RANDOM_32BIT_MAX);
|
||||
}
|
||||
|
||||
int rand(const int m) {
|
||||
int Math::rand(const int m) {
|
||||
return rand() % m;
|
||||
}
|
||||
|
||||
int rand(const int from, const int to) {
|
||||
int Math::rand(const int from, const int to) {
|
||||
return (rand() % (to - from)) + from;
|
||||
}
|
||||
|
||||
|
@ -44,22 +44,22 @@ void Math::randomize() {
|
||||
}
|
||||
|
||||
int Math::rand() {
|
||||
return rand();
|
||||
return ::rand();
|
||||
}
|
||||
|
||||
float Math::randf() {
|
||||
return rand() / static_cast<float>(RANDOM_32BIT_MAX);
|
||||
return ::rand() / static_cast<float>(RANDOM_32BIT_MAX);
|
||||
}
|
||||
|
||||
double Math::randd() {
|
||||
return rand() / static_cast<double>(RANDOM_32BIT_MAX);
|
||||
return ::rand() / static_cast<double>(RANDOM_32BIT_MAX);
|
||||
}
|
||||
|
||||
int rand(const int m) {
|
||||
int Math::rand(const int m) {
|
||||
return rand() % m;
|
||||
}
|
||||
|
||||
int rand(const int from, const int to) {
|
||||
int Math::rand(const int from, const int to) {
|
||||
return (rand() % (to - from)) + from;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user