Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Random Sequence Generation by Cellular Automata

0 views
Skip to first unread message

AngleWyrm

unread,
Oct 1, 2007, 4:57:24 AM10/1/07
to
After reading Stephen Wolfram's article
http://www.stephenwolfram.com/publications/articles/ca/86-random/ , I've
been trying to develop an implementation in C++.

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?

Jean-Marc Gulliet

unread,
Oct 2, 2007, 6:16:41 AM10/2/07
to
AngleWyrm wrote:

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

0 new messages