CPU: Wrong CPU Load %.
[tomato.git] / release / src / router / ppp / pppoecd / random.c
blobdf1f9b2d8809bec00a0b585cfc581b649fb04424
1 #include <string.h>
2 #include <sys/time.h>
3 #include <stdlib.h>
4 #include <sys/types.h>
5 #include <unistd.h>
7 #if 0
8 unsigned int get_mac_addr()
10 unsigned int ret;
11 char wan_mac_str[80];
12 char *ptr_1, *ptr_2;
14 strcpy(wan_mac_str, nvram_safe_get("wan_hwaddr"));
15 ptr_1 = wan_mac_str;
16 ptr_2 = ptr_1;
18 while(*ptr_2 != '\0')
20 if(*ptr_2 == ':');
21 ptr_2++;
22 *ptr_1 = *ptr_2;
23 ptr_1 ++;
24 ptr_2 ++;
27 //memcpy((char *)ret, &wan_mac_str[2], 4);
28 ret = atoi(&wan_mac_str[6]);
29 return ret;
31 #endif
33 void prng_init()
35 unsigned int seed;
36 struct timeval t;
38 gettimeofday(&t, NULL);
39 //seed = get_mac_addr() ^ t.tv_sec ^ t.tv_usec ^ getpid();
40 seed = t.tv_sec ^ t.tv_usec ^ getpid();
41 srand(seed);