-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
51 lines (45 loc) · 972 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// main.cpp
// google_test
//
// Created by Wang Yi on 17/3/17.
// Copyright © 2017 Wang Yiyiak.co. All rights reserved.
//
#include <iostream>
#include <time.h>
#include <cmath>
typedef long long ll;
void global_init()
{
//srand(time(nullptr));
unsigned int pseudo_seed = time(nullptr);
unsigned int seed = (unsigned int)((pseudo_seed * pseudo_seed));
srand(seed);
}
double recursive_method()
{
switch(rand() % 10)
{
case 0:
case 1:
return 1.0;
break;
case 2:
recursive_method() + recursive_method();
break;
case 3:
case 4:
case 5:
std::cout << "good result!" << std::endl;
default:
recursive_method();
}
return 100.0;
}
int main(int argc, const char * argv[]) {
// insert code here...
global_init();
recursive_method();
std::cout << "Hello, World!\n";
return 0;
}