MathGroup Archive 2007

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

Search the Archive

Re: Random Sequence Generation by Cellular Automata

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81744] Re: Random Sequence Generation by Cellular Automata
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Tue, 2 Oct 2007 05:49:34 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fdqcpk$mnp$1@smc.vnet.net>

AngleWyrm wrote:

> 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? 

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


  • Prev by Date: Re: using Save/Get with a function definition
  • Next by Date: Problem: different behavior, interactive vs noninteractive
  • Previous by thread: Random Sequence Generation by Cellular Automata
  • Next by thread: Number of interval Intersections for a large number of intervals