Presentation is loading. Please wait.

Presentation is loading. Please wait.

X Tours Coordinator: Prof. Yves Lansac Université François Rabelais, Tours, Loire Vallée, France.

Similar presentations


Presentation on theme: "X Tours Coordinator: Prof. Yves Lansac Université François Rabelais, Tours, Loire Vallée, France."— Presentation transcript:

1 x Tours Coordinator: Prof. Yves Lansac Université François Rabelais, Tours, Loire Vallée, France

2 Lab 0. Warm-up for Calculation of 

3 - Call “ran3.h” (prototype or definition of function). - Call “ran3.c” (implementation of function). - See “architecture.pdf” for the architecture. - Input how many sets of (x i, y i ) to generate. - Input a seed for random number generator. (a random-looking big number < 10 9 ) - To compile: 1)Create an object file from each C source file: gcc -c xxx.c gcc -c ran3.c 2) Link them together with the math library to produce an executable (called xxx): gcc -o xxx xxx.o ran3.o -lm 6. Print a set of random numbers (x i, y i ) using a random number generating function ran3.c. #include #include  ran3.h  /* function main */ main() { long seed; // random number generator seed double x;... /* generate a random number x in [0,1] */ x = ran3(&seed); y = ran3(&seed);... } double ran3(long *idum) {... } #ifndef RAN3_H #define RAN3_H double ran3(long *idum); #endif [xxx.c] [ran3.c] [ran3.h] implementation main prototype function calls


Download ppt "X Tours Coordinator: Prof. Yves Lansac Université François Rabelais, Tours, Loire Vallée, France."

Similar presentations


Ads by Google