File: simple-simple.c

package info (click to toggle)
sprng 2.0a-16
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,308 kB
  • sloc: ansic: 30,353; fortran: 1,618; makefile: 575; cpp: 58; sh: 5
file content (26 lines) | stat: -rw-r--r-- 849 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/****************************************************************************/
/*        ____Demonstrates the use of sprng without initialization____      */
/* A few double precision random numbers are generated, without the user    */
/* explicitly initializing the streams. SPRNG automatically initializes a   */
/* stream with default seed and parameter the first time 'sprng' is called. */
/****************************************************************************/

#include <stdio.h>

#define SIMPLE_SPRNG		/* simple interface                         */
#include "sprng.h"              /* SPRNG header file                        */



main()
{
  double rn;
  int i;

  printf(" Printing 3 random numbers in [0,1):\n");
  for (i=0;i<3;i++)
  {
    rn = sprng();		/* generate double precision random number  */
    printf("%f\n",rn);
  }
}