Thread: pseudo-random number generator problem

  1. #1
    Registered User
    Join Date
    Jun 2011

    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.

                 { 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:

    #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++)
    	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??

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    If you remember that the right side of a piecewise-defined function should have the word "if" in it, then you're golden:
    if x[n] <= m then
        x[n+1] := x[n]/m
        x[n+1] := (1-x[n])/(1-m)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need a random number generator thats not compleatly random
    By thedodgeruk in forum C++ Programming
    Replies: 1
    Last Post: 06-05-2011, 06:48 AM
  2. problem with random number generator
    By Niss in forum C Programming
    Replies: 6
    Last Post: 10-01-2008, 06:03 PM
  3. Replies: 2
    Last Post: 08-13-2008, 08:02 AM
  4. random number generator
    By noodle24 in forum C++ Programming
    Replies: 7
    Last Post: 05-11-2006, 10:41 AM
  5. Independent streams of pseudo random number generator
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-15-2001, 05:32 AM