MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Random Sequence Generation by Cellular Automata

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81673] Random Sequence Generation by Cellular Automata
  • From: "AngleWyrm" <anglewyrm_idontreadspamthankyou at yahoo.com>
  • Date: Mon, 1 Oct 2007 04:47:21 -0400 (EDT)

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? 




  • Prev by Date: StatusArea
  • Next by Date: Number of interval Intersections for a large number of intervals
  • Previous by thread: StatusArea
  • Next by thread: Re: Random Sequence Generation by Cellular Automata