diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-09 11:26:50 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-09 11:26:50 +0100 |
| commit | b799c007a1b6911fcbe5141429ea541e1277ebdd (patch) | |
| tree | d70ad0826ad2fc2d635adf9afecf89af0838d20b /cpp01/ex02/main.cpp | |
| parent | 1e9d90bdf9ef5fc05093d3449d883597c7f896de (diff) | |
| download | piscine_cpp-b799c007a1b6911fcbe5141429ea541e1277ebdd.tar.gz piscine_cpp-b799c007a1b6911fcbe5141429ea541e1277ebdd.tar.bz2 piscine_cpp-b799c007a1b6911fcbe5141429ea541e1277ebdd.zip | |
Fixing some edge cases in cpp00 and cpp01, Updated formatting
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; } |
