Seed with time
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 12 Nov 2016 13:08:19 +0000 (05:08 -0800)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 12 Nov 2016 13:08:19 +0000 (05:08 -0800)
markov.cpp

index 152e7a4..36ec599 100644 (file)
@@ -1,7 +1,8 @@
 #include <iostream>
 #include <fstream>
-#include <string.h>
+#include <cstring>
 #include <map>
+#include <ctime>
 
 typedef std::map<std::string, std::map<std::string, std::map<std::string, int>>> MarkovChain;
 
@@ -21,6 +22,7 @@ extern "C" {
 
         while (in >> a >> b >> c >> d) __chain[a][b][c] = d;
 
+        srand(time(NULL));
         chain_initialized = true;
     }
 
This page took 0.024606 seconds and 4 git commands to generate.