Introduction
Introduction Statistics Contact Development Disclaimer Help
Updated - gnuskii - GNUSki improved for ascii skiing experience.
git clone git://bitreich.org/gnuskii git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws…
Log
Files
Refs
Tags
README
LICENSE
---
commit bddc46123ab7783e37faee6ea6e0eb28d8feed07
parent 13598fd15595900aa167fe48d2518f96f6375daa
Author: Rudolf Olah <[email protected]>
Date: Tue, 23 Jul 2024 17:33:53 -0400
Updated
Diffstat:
A src/common.h | 32 +++++++++++++++++++++++++++++…
1 file changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/common.h b/src/common.h
@@ -0,0 +1,32 @@
+/***************************************
+Name: common.h
+Desc: Contains common functions
+Copyright (C) 2005 Rudolf Olah
+See GPL.txt for more details
+***************************************/
+#ifndef COMMON_H
+#define COMMON_H
+#include <string.h>
+#include <time.h>
+#include <math.h>
+
+int rndInt(int min, int max)
+{
+ //Swap numbers to make sure max = the maximum
+ int temp = max;
+ if (min>max)
+ {
+ max = min;
+ min = temp;
+ };
+ // Generate a number between min and max inclusive
+ int i = rand() % max + min;
+ srand(time(NULL)+i*25-rand()*time(NULL));
+ while (i < min || i > max)
+ {
+ i = rand() % max + min;
+ };
+ //printf("Generated number...%i\n",i); //Debug message
+ return i;
+};
+#endif
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.