diff options
Diffstat (limited to 'cpp01/ex02/main.cpp')
| -rw-r--r-- | cpp01/ex02/main.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/cpp01/ex02/main.cpp b/cpp01/ex02/main.cpp index 291fddb..e8fb2c9 100644 --- a/cpp01/ex02/main.cpp +++ b/cpp01/ex02/main.cpp @@ -6,29 +6,40 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 09:47:21 by charles #+# #+# */ -/* Updated: 2020/04/13 09:48:29 by charles ### ########.fr */ +/* Updated: 2020/11/09 10:33:18 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include <cstdlib> +#include <ctime> +#include <fstream> #include "Zombie.hpp" #include "ZombieEvent.hpp" int main() { - Zombie* z; + Zombie* z; ZombieEvent zevent; - Zombie zStack("onTheStack", "IdontLikeHeap"); + Zombie zStack("onTheStack", "IdontLikeHeap"); - srand(time(NULL)); - zevent.setZombieType("standard"); + int seed; + std::ifstream devRandom("/dev/random"); + if (devRandom.is_open()) + { + devRandom.read((char*)&seed, sizeof(int)); + devRandom.close(); + } + else + seed = time(NULL); + srand(seed); + zevent.setZombieType("NotRandom"); z = zevent.newZombie("jean"); + zevent.setZombieType("random"); delete z; for (int i = 0; i < 5; i++) { z = zevent.randomChump(); delete z; } - return 0; } |
