diff options
author | Reimar <Reimar@Leike.name> | 2014-12-04 12:02:53 +0100 |
---|---|---|
committer | Reimar <Reimar@Leike.name> | 2014-12-04 12:02:53 +0100 |
commit | d7c0925b3d7ffb1a58402c05e664966e2f8a597f (patch) | |
tree | 62cef6cc5b74481799c10dab8a18e756b74ea7e9 /random.cpp | |
parent | 33e9f1db579685dd1ffab767ba7733a8e9503c78 (diff) | |
download | SpaceCannon-d7c0925b3d7ffb1a58402c05e664966e2f8a597f.tar SpaceCannon-d7c0925b3d7ffb1a58402c05e664966e2f8a597f.tar.gz SpaceCannon-d7c0925b3d7ffb1a58402c05e664966e2f8a597f.tar.bz2 SpaceCannon-d7c0925b3d7ffb1a58402c05e664966e2f8a597f.tar.xz SpaceCannon-d7c0925b3d7ffb1a58402c05e664966e2f8a597f.zip |
added custom random generator, ball no has a roll animation, revisited difficulty impact
Diffstat (limited to 'random.cpp')
-rw-r--r-- | random.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/random.cpp b/random.cpp new file mode 100644 index 0000000..92a3c4c --- /dev/null +++ b/random.cpp | |||
@@ -0,0 +1,18 @@ | |||
1 | |||
2 | long long rand_state = 24; | ||
3 | long long rand_para1 = 37; | ||
4 | long long rand_para2 = 37; | ||
5 | |||
6 | int randn() | ||
7 | { | ||
8 | rand_state = (rand_state*rand_state + rand_state*rand_para1 +rand_para2)%15555557; | ||
9 | return rand_state; | ||
10 | } | ||
11 | |||
12 | //seed with number from 0 to 672 | ||
13 | void srandn(int seed) | ||
14 | { | ||
15 | rand_state = seed + 2753; | ||
16 | |||
17 | randn(); | ||
18 | } | ||