/* tbran.c CCMATH mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU library * public license (LGPL). ( See the lgpl.license file for details.) * ------------------------------------------------------------------------ */ /* Test: bran setbran Input parameters: s -> unsigned integer: pseudorandom generator seed n -> integer parameter (output range [0,n-1]) m -> sample size */ #include "ccmath.h" void main(int na,char **av) { unsigned int s; int n,m,i,k,*nh; if(na!=4){ printf("para: seed(hex) argument num_out\n"); exit(-1);} sscanf(*++av,"%x",&s); n=atoi(*++av); m=atoi(*++av); printf(" seed= %x\n",s); printf(" arg: n= %d\n",n); printf(" sample sizw m= %d\n",m); nh=(int *)calloc(sizeof(int),n+1); /* initialize pseudorandom integer generator */ setbran(s); for(i=0; i