-
Notifications
You must be signed in to change notification settings - Fork 0
/
rand1t.c
44 lines (32 loc) · 803 Bytes
/
rand1t.c
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
38
39
40
41
42
43
/* Link in this file for random number generation using drand48() */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
double ran1()
{
double drand48();
return( drand48() );
}
void seedit( char *flag )
{
FILE *fopen(), *pfseed;
unsigned short seedv[3], *seed48();
if( flag[0] == 's' ){
seedv[0] = (unsigned short)time( NULL ) ;
seedv[1] = 27011; seedv[2] = 59243;
seed48( seedv );
printf("\n%d %d %d\n", seedv[0], seedv[1], seedv[2] );
}
}
int
commandlineseed( char **seeds)
{
unsigned short seedv[3], *seed48();
int i ;
seedv[0] = atoi( seeds[0] );
seedv[1] = atoi( seeds[1] );
seedv[2] = atoi( seeds[2] );
printf("\n%d %d %d\n", seedv[0], seedv[1], seedv[2] );
seed48(seedv);
return(3);
}