Thread: Please help me on my simple program PSEUDO RANDOM NUMBERS

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I thought you were going to use rand(), MJ.

    So what's your goal here? Generate 20 unique random numbers? Please post up your latest code, and a good description of just what you want to do? Also, of course, what has you stumped currently.

    I see "eagle eye" Tim has been helpful - well done, Tim.

  2. #2
    Registered User
    Join Date
    Sep 2010
    Posts
    13
    Quote Originally Posted by Adak View Post
    I thought you were going to use rand(), MJ.

    So what's your goal here? Generate 20 unique random numbers? Please post up your latest code, and a good description of just what you want to do? Also, of course, what has you stumped currently.

    I see "eagle eye" Tim has been helpful - well done, Tim.

    Actually what i want to do is... the output will stop if the output is happened twice..

    Example:

    n=0( line 1 )= 2
    n=1( line 2 )= 4
    n=2( line 3 )= 1
    n=3( line 4 )= 3
    n=4( line 5 )= 7
    n=5( line 6 )= 2 << it will stop here because the output here(which is "2") is the same in the output for n=0(which is in line 1)

    another examples;
    n=0( line 1 )= 2
    n=1( line 2 )= 4
    n=2( line 3 )= 12
    n=3( line 4 )= 3
    n=4( line 5 )= 7
    n=5( line 6 )= 5
    n=6( line 7 )= 10
    n=7( line 8 )= 6
    n=8( line 9 )= 11
    n=9( line 10 )=42
    n=10( line 11 )= 9
    n=11( line 12 )= 2
    ____________

    n=0( line 1 )= 4
    n=1( line 2 )= 6
    n=2( line 3 )= 4


    I hope you understand what im trying to say.. Thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about random numbers
    By Kempelen in forum C Programming
    Replies: 2
    Last Post: 07-02-2008, 06:28 AM
  2. drand48(): generating pseudo random numbers in a range
    By Isolda_ in forum C Programming
    Replies: 2
    Last Post: 08-31-2007, 11:21 AM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. Simple window program
    By baniakjr in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2006, 03:46 PM
  5. Generating Random Numbers
    By FromHolland in forum C++ Programming
    Replies: 6
    Last Post: 06-16-2003, 09:05 AM