blob: 51ef6e21b0917e70b6c0009e1f35ae93c9f1e32b (
plain)
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
|
#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;
}
|