LIBS = -L/usr/lib -lm
API = g_plot.o general.o
-OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation kettenbruchentwicklung bessel_1 bessel_2
+OBJS = newton zentral homogen integral-1_2 integral-2_2 polynom_interpolation kettenbruchentwicklung bessel_1 bessel_2 check_rand
all: $(OBJS)
bessel_2: $(API)
$(CC) $(CFLAGS) -o $@ $(API) $(LIBS) bessel_2.c
+check_rand: $(API)
+ $(CC) $(CFLAGS) -o $@ $(API) $(LIBS) check_rand.c
+
clean:
rm $(API) $(OBJS)
--- /dev/null
+#include <stdio.h>
+#include <time.h>
+#include "general.h"
+#include "g_plot.h"
+
+#define STEPS 1000000
+
+int main(int argc,char **argv) {
+ int i;
+
+ my_srand(time(NULL));
+
+ for(i=0;i<STEPS;i++)
+ printf("%f %f\n",my_nrand(),my_nrand());
+
+ return 1;
+}
double absolute_value(double l) {
return l<0?-l:l;
}
+
+#define __A 48271
+#define __Q 44488
+#define __R 3399
+#define __M ((2<<31)-1)
+#define NRAND_MAX
+
+/* global variable -- I_{k+1} dedpends on I_{k} */
+static int idum=123456;
+
+int my_rand(int max) {
+ int h;
+ h=idum/__Q;
+ idum=__A*(idum-h*__Q)-h*__R;
+ if(idum<0) idum+=__M;
+ return(idum*(max/__M));
+}
+
+int my_srand(int seed) {
+ printf("debug: seed = %d\n",seed);
+ return(idum=seed);
+}
+
+double my_nrand(void) {
+ int h;
+ h=idum/__Q;
+ idum=__A*(idum-h*__Q)-h*__R;
+ if(idum<0) idum+=__M;
+ return(1.0*idum/__M);
+}
double fak(int l);
double fak2(int l);
double absolute_value(double l);
-
+int my_rand(int max);
+int my_srand(int seed);
+double my_nrand(void);