libs-base/Testing/randoms.m
Richard Frith-Macdonald db7b22a4fb Tidy up use of white space so we have it after if/for/while and not after (
or before ) or padding at end of line.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20773 72102866-910b-0410-8b05-ffd578937521
2005-02-22 11:22:44 +00:00

35 lines
733 B
Objective-C

#include <GNUstepBase/Random.h>
#include <GNUstepBase/RNGBerkeley.h>
#include <GNUstepBase/RNGAdditiveCongruential.h>
int main()
{
id r;
id rng;
int i;
r = [[Random alloc] init];
printf("float\n");
for (i = 0; i < 20; i++)
printf("%f\n", [r randomFloat]);
printf("doubles\n");
for (i = 0; i < 20; i++)
printf("%f\n", [r randomDouble]);
rng = [[RNGBerkeley alloc] init];
printf("%s chi^2 = %f\n",
[rng name], [Random chiSquareOfRandomGenerator:rng]);
[r release];
rng = [[RNGAdditiveCongruential alloc] init];
/*
for (i = 0; i < 50; i++)
printf("%ld\n", [r nextRandom]);
*/
printf("%s chi^2 = %f\n",
[rng name], [Random chiSquareOfRandomGenerator:rng]);
[rng release];
exit(0);
}