
//
// Written by John A deLaubenfels, https://www.adaptune.com/steg.htm .
// Permission granted to use freely in any non-fraudulent way.
//


#ifndef RANDD_H
#define RANDD_H






#define RANDDD randos
#define RANDD2 randosWide  // 04-21-01
#define SRAND srandos
// #define SLASH '\\'
// #define OTHER_SLASH '/'
#define ATOI atoi
#define MAX_LINES (32768)   /* MORE!!! */

#define BILL_GATES


#include <malloc.h>
#include <fcntl.h>


#ifdef _WIN32
#include <dos.h>
#include <io.h>
#endif // _WIN32

// #define NEWF_FLAGS (_O_WRONLY | _O_CREAT | _O_BINARY)
// #define OLDF_FLAGS (_O_RDONLY            | _O_BINARY)
#define RDWR_FLAGS (_O_RDWR              | _O_BINARY)






#define RAND_LH(low, high)  ((long)low + rand_n((long)high - (long)low + 1))                // 07-12-08 (jdl); was  (long)((long)(low) + ((RANDDD() % ((long)(high) - (long)(low) + 1L))))
#define RAND_N(numb)        rand_n(numb)       // 07-12-08 (jdl); was  (long)(RANDDD() % (long)(numb))
#define RAND_NL(numb)       rand_n(numb)       // 07-12-08 (jdl); was  (long)(RANDD2() % (long)(numb))
#define RANDDL              (((long)RANDDD() << 16) + (long)RANDDD())
// #define SPIN                {int i; for(i=0; i<256; i++) {RANDDD();}}
#define SPIN                (spin())

#define MAX_CBRN (2048)
/* #define MAX_LINES (4096) */ /* moved up for more... */

#define N_RANDOS_WIDE        (1073741824)     // 07-12-08 (jdl): 2 ^ 30



void srandos(long seed);
long randos(void);
long randosWide(void);
long randInit(void);
long randInit(long theSeed);   // override 06-28-01
long randModi(long theModi);   // 03-16-02
void spin(void);
double randDoub(void);         // 12-30-01: 0.0 to just shy of 1.0
double randDoubRev(void);      // 12-30-01: just above 0.0 to 1.0
long randFromPwd(void);        // 03-16-02
long rand_n(long iDesire);     // 07-12-08 (jdl)



#endif // !RANDD_H


