uint32_t ca_random()
{
static uint32_t left, right, center=0x49ef96bf, result;
result=0;
for(int i=0; i<32; i++){
left = (center << 1) | (center & 0x80000000) >> 31;
right = (center >> 1) | (center & 0x00000001) << 31;
center = left ^ (center | right);
result = result | (((center & 0x10000) >> 16) << i);
}
return result;
};
Any recommendations for improvement?
This forum is dedicated to the Computer Algebra System (CAS)
Mathematica. Since your request is about programming in C++ and Stephen
Wolfram's New Kind of Science (NKS), I would strongly encourage you to
post your question in one of the NKS forums available at
http://forum.wolframscience.com/
or/and on one of the newsgroups dedicated to C++ programming: you will.
Regards,
--
Jean-Marc