File: random.c

package info (click to toggle)
echoping 6.0.2-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,596 kB
  • ctags: 380
  • sloc: sh: 8,966; ansic: 3,350; makefile: 162
file content (37 lines) | stat: -rw-r--r-- 515 bytes parent folder | download | duplicates (5)
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
/*
 * Pseudo-random plugin. Just an example. 
 * 
 * $Id: random.c 377 2007-03-12 20:48:05Z bortz $
 */

#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>

char           *
init(const int argc, const char *argv[])
{
	struct timeval  tv;
	(void) gettimeofday(&tv, (struct timezone *) NULL);
	srand(tv.tv_usec);
	return "7";		/* Not used, just to say we use the cooked interface 
				 */
}

void
start()
{
}

int
execute()
{
	usleep(rand() % 1000000);
	return 1;
}

void
terminate()
{
}