ASR3/ASR3.1/TP05 Pointeurs Signaux/exo1/exo1.c
2021-11-15 17:44:02 +01:00

30 lines
411 B
C

#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<stdint.h>
#include<assert.h>
#include "helpers.h"
uint64_t tirs=0,
tirs_in=0;
double pi=0,
t1;
int main(int argc,char * argv[]){
double x,
y;
t1 = tstamp();
alarm(5);
while(1){
x = ((double)rand())/(double)RAND_MAX;
y = ((double)rand())/(double)RAND_MAX;
tirs ++;
if (x*x+y*y<=1) tirs_in ++;
}
}