Elementary cellular automaton/Random number generator: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Add another eca generator.)
(rephrasing)
Line 4: Line 4:
Steven Wolfram's recommendation for random number generation from rule 30 consists in extracting successive bits in a fixed position in the array of cells, as the automaton changes state.
Steven Wolfram's recommendation for random number generation from rule 30 consists in extracting successive bits in a fixed position in the array of cells, as the automaton changes state.


The purpose of this task is to demonstrate this. With the code written in the [[Elementary cellular automaton|parent task]], which you don't need to re-write here, show the ten first bytes that emerge from this recommendation. To be precise, you will start with a state of all cells but one equal to zero, and you'll follow the evolution of the particular cell whose state was initially one. Then you'll regroup those bits by packets of eight, reconstituting bytes with a the [[wp:most significant bit|most significant bit]] first.
The purpose of this task is to demonstrate this. With the code written in the [[Elementary cellular automaton|parent task]], which you don't need to re-write here, show the ten first bytes that emerge from this recommendation. To be precise, you will start with a state of all cells but one equal to zero, and you'll follow the evolution of the particular cell whose state was initially one. Then you'll regroup those bits by packets of eight, reconstituting bytes with the first bit being the [[wp:most significant bit|most significant]].


You can pick which ever length you want for the initial array but it should be visible in the code so that your output can be reproduced with an other language.
You can pick which ever length you want for the initial array but it should be visible in the code so that your output can be reproduced with an other language.