Local math class.

Dependents:   DISCO-F746NG_test001

Revision:
0:d75b71489993
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Rand.cpp	Fri Jun 24 01:20:32 2016 +0000
@@ -0,0 +1,47 @@
+//
+//  2016/5/23, Copyright (c) 2016 Takashi Inoue
+//  Button OverLapping Class Source File
+//  ver 0.9 rev 0.1 2016/5/23
+//-----------------------------------------------------------
+
+
+#include "Rand.hpp"
+
+namespace TakaIno
+{
+// Constructor
+
+    Rand::Rand() {;}
+
+    unsigned long Rand::GetRand(void) {
+
+        unsigned long t;
+
+        t=(x^(x<<11));
+        x=y;
+        y=z;
+        z=w;
+
+        return( w=(w^(w>>19))^(t^(t>>8)) );
+    }
+    
+    unsigned long Rand::GetRand(unsigned long max) {
+
+        unsigned long t;
+
+        t=(x^(x<<11));
+        x=y;
+        y=z;
+        z=w;
+        w=(w^(w>>19))^(t^(t>>8));
+        
+        return( w % max );
+    }
+       
+     unsigned long Rand::x=123456789;
+     unsigned long Rand::y=362436069;
+     unsigned long Rand::z=521288629;
+     unsigned long Rand::w=88675123;
+
+
+}