/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* lottery.c
* Copyright (C) 2018 TikalonLLC
*
* lottery is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* lottery is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*/
/*
The RNG here is based on the code contained in the article, "64-bit KISS RNGs,"
by George Marsaglia (Feb 28, 2009). As explained in the article, "This 64-bit
KISS RNG has three components, each nearly good enough to serve alone. The
components are:
Multiply-With-Carry (MWC), period (2^121+2^63-1)
Xorshift (XSH), period 2^64-1
Congruential (CNG), period 2^64
see https://www.thecodingforums.com/threads/64-bit-kiss-rngs.673657/
*/
#include
#include
#include
#include
#define num1 43
#define num2 222
#define play_number 303
#define MWC (t=(x<<58)+c, c=(x>>6), x+=t, c+=(x>17), y^=(y<<43) )
#define CNG ( z=6906969069LL*z+1234567 )
#define KISS (MWC+XSH+CNG)
#define trials 100000000
#define iterations 1000
int i;
int j;
int n;
FILE *outdata;
clock_t t_start, t_end;
double pgm_time;
static unsigned long long
x=1234567890987654321ULL,c=123456123456123456ULL,
y=362436362436362436ULL,z=1066149217761810ULL,t;
void check_RNG(int lim)
{
//check random number generation by comparing frequency of occurence of
//two different numbers, num1 and num2
int count;
count = 0;
for(i=0;i