ftp.nice.ch/pub/next/developer/resources/libraries/libobjects.0.1.0.s.tar.gz#/libobjects-0.1.0/checks/test12.m

This is test12.m in view mode; [Download] [Up]

#include <objects/Random.h>
#include <objects/RNGBerkeley.h>
#include <objects/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 free];

  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]);
  [r free];

  exit(0);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.