ICEACE Model: Closed Economy  1.0.0
Design Documentation of ICEACE Model
 All Data Structures Files Functions Variables Typedefs Macros Pages
library_functions.c
Go to the documentation of this file.
1 
6 #include "header.h"
7 #include "library_header.h"
8 
15 int random_int(int min,int max)
16 {
17  return min + rand() % (max - min + 1);
18 }
19 
20 double max(double a, double b)
21 {
22  return (a >= b) ? a : b;
23 }
24 
25 double min(double a, double b)
26 {
27  return (a <= b) ? a : b;
28 }
29 
30 int max_int(int a, int b)
31 {
32  return (a >= b) ? a : b;
33 }
34 
35 int min_int(int a, int b)
36 {
37  return (a <= b) ? a : b;
38 }
39 
40 /*
41  * \fn: int random_number(int a, int b)
42  * \brief: Return a random interger between a and b inclusive.
43  */
44 int random_number(int a, int b)
45 {
46  return (a+(int)(((double)b)*rand()/(RAND_MAX+1.0)));
47 }