mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 08:26:27 +00:00
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
35 lines
733 B
Objective-C
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);
|
|
}
|