diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2013-10-07 14:11:24 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2013-10-07 14:11:24 +0200 |
| commit | 677385ffdd1e330cfba4dd712ca58595feeea41d (patch) | |
| tree | d256c7c6a86b3efe4af2e97fa72cc35eb32ec33e /calc.c | |
| download | fx-maze-677385ffdd1e330cfba4dd712ca58595feeea41d.tar.gz fx-maze-677385ffdd1e330cfba4dd712ca58595feeea41d.zip | |
initial commit
Diffstat (limited to 'calc.c')
| -rw-r--r-- | calc.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +#include "global.h"
+#include "calc.h"
+#include "syscalls.h"
+
+int TDist[64];
+
+static uint lastrandom = 0x123456;
+
+void seedrandom(void)
+{
+ lastrandom = RTC_GetTicks();
+}
+
+unsigned int random()
+{
+ lastrandom = (0x41C64E6D*lastrandom) + 0x3039;
+ return (lastrandom >> 16);
+}
+
+void table()
+{
+ int x;
+ for(x = 0; x < 64; x++)
+ {
+ TDist[x] = (64 << 8) / (2.0 * x - 64);
+ }
+}
+
+void fill(uint *ptr, uint element, uint arraysize)
+{
+ for(;arraysize > 0; arraysize--, ptr++)
+ *ptr = element;
+}
|
