usage of rand()

Discussion in 'C++' started by Orhan Demirel, Jul 21, 2003.

  1. I use VC++ 6.0 and I try to get random numbers with rand() but it gives me
    same number.There is a solution in C for this problem : randomize( ) but I
    need it in C++.
    If someone tell me how I get random numbers I'll be glad .
     
    Orhan Demirel, Jul 21, 2003
    #1
    1. Advertisements

  2. Orhan Demirel

    Adam Fineman Guest

    Orhan Demirel wrote:
    > I use VC++ 6.0 and I try to get random numbers with rand() but it gives me
    > same number.There is a solution in C for this problem : randomize( ) but I
    > need it in C++.
    > If someone tell me how I get random numbers I'll be glad .
    >
    >
    >
    >

    The solution in C is the same as the solution in C++: srand(), not
    randomize().

    - Adam
     
    Adam Fineman, Jul 21, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Niko D. Barli

    rand function in Modelsim 5.7c

    Niko D. Barli, Aug 26, 2004, in forum: VHDL
    Replies:
    9
    Views:
    6,822
    Niko D. Barli
    Sep 6, 2004
  2. metfan
    Replies:
    2
    Views:
    5,064
    Robert Olofsson
    Oct 21, 2003
  3. Colin J. Williams

    Webchecker Usage - a problem with local usage

    Colin J. Williams, Feb 25, 2004, in forum: Python
    Replies:
    1
    Views:
    725
    Colin J. Williams
    Feb 26, 2004
  4. hvt
    Replies:
    0
    Views:
    1,399
  5. hvt
    Replies:
    0
    Views:
    1,743
  6. Krist
    Replies:
    8
    Views:
    9,257
    Arne Vajhøj
    Feb 10, 2010
  7. 7stud --

    rand() v. rand(0.1) ?

    7stud --, Sep 15, 2007, in forum: Ruby
    Replies:
    6
    Views:
    495
    Morton Goldberg
    Sep 16, 2007
  8. MrsEntity
    Replies:
    20
    Views:
    750
Loading...