<!-- hamlet
<!-- copytar
examples/                                                                                           0040755 0002611 0000666 00000000000 06355554252 0013541 5                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        examples/random/                                                                                    0040755 0002611 0000666 00000000000 06355554175 0015025 5                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        examples/random/main.c                                                                              0100644 0002611 0000666 00000000603 06355554173 0016107 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
/*
Created:  Joe Zachary, October 25, 1992
Modified: 
*/

#include <stdio.h>
#include "random.h"


/* This prints out ten consecutive "random" numbers. */

void main () {
  int i, seed;
  printf("Please enter a seed for the random number generator: ");
  scanf("%d", &seed);
  lastNumber = seed;
  for (i=1; i <= 10; i++)
    {
      printf("%d\n", random(1000));
    }
}

                                                                                                                             examples/random/random.c                                                                            0100644 0002611 0000666 00000000513 06355554171 0016441 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
/*
Created:  Joe Zachary, October 25, 1992
Modified: 
*/

#include "random.h"


/* The random number seed. */

int lastNumber = 1;


/* Returns a different "random" integer between 0 and N-1
   every time it is called. */

int random (int N) {
  lastNumber = (lastNumber*234721 + 17223) % N;
  return(lastNumber);
}

                                                                                                                                                                                     examples/random/random.h                                                                            0100644 0002611 0000666 00000000251 06032335221 0016426 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /*
Created:  Joe Zachary, October 25, 1992
Modified: 
*/


/* Returns a different "random" integer between 0 and N-1
   every time it is called. */

int random (int N);
                                                                                                                                                                                                                                                                                                                                                       examples/auto.c                                                                                     0100644 0002611 0000666 00000001065 06355554245 0014656 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
/* Illustrates the "auto" storage class.

Created:  Joe Zachary, October 25, 1992
Modified: 
*/

#include <stdio.h>


/* This function is supposed to return a different "random"
   integer between 0 and N-1, inclusive,  every time it is
   called.  IT DOESN'T WORK!!! */

int random (int N) {
  auto int lastNumber = 1;
  lastNumber = (lastNumber*234721 + 17223) % N;
  return(lastNumber);
}


/* This prints out ten consecutive "random" numbers. */

main () {
  auto int i;
  for (i=1; i <= 10; i++)
    {
      printf("%d\n", random(1000));
    }
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                           examples/global.c                                                                                   0100644 0002611 0000666 00000001207 06355554246 0015145 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
/* Illustrates global variables

Created:  Joe Zachary, October 25, 1992
Modified: 
*/

#include <stdio.h>


/* This function is supposed to return a different "random"
   integer between 0 and N-1, inclusive,  every time it is
   called.  */

int lastNumber = 1;

int random (int N) {
  lastNumber = (lastNumber*234721 + 17223) % N;
  return(lastNumber);
}


/* This prints out ten consecutive "random" numbers. */

void main () {
  int i, seed;
  printf("Please enter a seed for the random number generator: ");
  scanf("%d", &seed);
  lastNumber = seed;
  for (i=1; i <= 10; i++)
    {
      printf("%d\n", random(1000));
    }
}
                                                                                                                                                                                                                                                                                                                                                                                         examples/static2.c                                                                                  0100644 0002611 0000666 00000001256 06355554247 0015263 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
/* Illustrates the "static" storage class.

Created:  Joe Zachary, October 25, 1992
Modified: 
*/

#include <stdio.h>


/* This function is supposed to return a different "random"
   integer between 0 and N-1, inclusive,  every time it is
   called.  */

int random (int N) {
  static int lastNumber = 1;
  lastNumber = (lastNumber*234721 + 17223) % N;
  return(lastNumber);
}


/* This prints out ten consecutive "random" numbers.  IT DOESN'T WORK!!! */

void main () {
  int i, seed;
  printf("Please enter a seed for the random number generator: ");
  scanf("%d", &seed);
  lastNumber = seed;
  for (i=1; i <= 10; i++)
    {
      printf("%d\n", random(1000));
    }
}
                                                                                                                                                                                                                                                                                                                                                  examples/static1.c                                                                                  0100644 0002611 0000666 00000001045 06355554250 0015250 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
/* Illustrates the "static" storage class.

Created:  Joe Zachary, October 25, 1992
Modified: 
*/

#include <stdio.h>


/* This function is supposed to return a different "random"
   integer between 0 and N-1, inclusive,  every time it is
   called. */

int random (int N) {
  static int lastNumber = 1;
  lastNumber = (lastNumber*234721 + 17223) % N;
  return(lastNumber);
}


/* This prints out ten consecutive "random" numbers. */

void main () {
  int i;
  for (i=1; i <= 10; i++)
    {
      printf("%d\n", random(1000));
    }
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           