Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2024 |
3 |
|
|
** zappy |
4 |
|
|
** File description: |
5 |
|
|
** Random |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#ifndef RANDOM_HPP_ |
9 |
|
|
#define RANDOM_HPP_ |
10 |
|
|
|
11 |
|
|
#include <stdlib.h> |
12 |
|
|
|
13 |
|
|
class Random { |
14 |
|
|
public: |
15 |
|
|
Random() {} |
16 |
|
|
~Random() {} |
17 |
|
|
|
18 |
|
|
static int random(int min, int max) { |
19 |
|
✗ |
return rand() % (max - min + 1) + min; |
20 |
|
|
} |
21 |
|
|
static float random(float min, float max) { |
22 |
|
|
return (rand() / (float)RAND_MAX) * (max - min) + min; |
23 |
|
|
} |
24 |
|
|
static bool randomBool() { |
25 |
|
|
return rand() % 2; |
26 |
|
|
} |
27 |
|
|
protected: |
28 |
|
|
private: |
29 |
|
|
}; |
30 |
|
|
|
31 |
|
|
#endif /* !RANDOM_HPP_ */ |
32 |
|
|
|