# pseudo-random number generator problem

• 06-26-2011
clarkk
pseudo-random number generator problem
Hi guys im trying to make my own pseudo-random number generator from the algorithm below using the kent chaotic map.

Code:

```                  { x(n)/m,  0 < x(n) <=m x(n+1)= {             {(1-x(n))/1-m,  m<x(n) <1```
where 0<m<1 (m could be 0.7 for example and all other variables could be anything)

I've tried playing around with loops for example but cant get it working:

Code:

```#include <iostream> int main (int argc, char * const argv[]) {           double m = 0.7;         double x[10];         double k = 10;         int n, Chaotic_map; {                for (n=0;n<k;n++)                 x[n]+1=x[n]/m;                 for (m<x[n]<1)                 Chaotic_map= x[n]+1=(1-x[n])/(1-m);         printf("%d", Chaotic_map);             return 0; }```
But im still lost, Any ideas??
• 06-26-2011
Salem
Some URL's to where these things are described would be useful.

Don't assume that we
- know what a "kent chaotic map" is
- can be bothered to do a lot of legwork (*n cross-posts) to find out
- can possibly work it out from the non-compilable code you posted.
• 06-27-2011
tabstop
If you remember that the right side of a piecewise-defined function should have the word "if" in it, then you're golden:
Code:

```if x[n] <= m then     x[n+1] := x[n]/m else     x[n+1] := (1-x[n])/(1-m)```