We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5c643b commit a3e831fCopy full SHA for a3e831f
tests/src/random-gen.cpp
@@ -0,0 +1,29 @@
1
+
2
+// Random number generator in range of (min,max)
3
+// in linear_congruential_engine
4
5
+#include <iostream>
6
+#include <chrono>
7
+#include <random>
8
+using namespace std;
9
10
+// driver program
11
+int main ()
12
+{
13
14
+ // finds the time between the system clock
15
+ //(present time) and clock's epoch
16
+ unsigned seed = chrono::system_clock::now().time_since_epoch().count();
17
18
+ // minstd_rand0 is a standard
19
+ // linear_congruential_engine
20
+ minstd_rand0 generator (seed);
21
22
+ // generates the random number
23
+ cout << generator() << " is a random number between ";
24
25
+ //use of min and max functions
26
+ cout << generator.min() << " and " << generator.max();
27
28
+ return 0;
29
+}
0 commit comments