Local math class.
Dependents: DISCO-F746NG_test001
Rand.cpp
- Committer:
- InoueTakashi
- Date:
- 2016-06-24
- Revision:
- 0:d75b71489993
File content as of revision 0:d75b71489993:
// // 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; }