Thread: plz help w/ srand();

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    3

    plz help w/ srand();

    Hi everyone,
    i have srand((unsigned)time(NULL)); in my code, and I keep on getting called object is not a function error. I've included <stdlib.h>, and i use Dev-C++ the latest version. Can anyone plz help?
    ~*sB*~

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    <time.h>
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    ..uh.. I had <time.h> already (thx for ur help anyway )
    anything else?
    ~*sB*~

  4. #4
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Sorry...I'm only psychic on Tuesdays. Maybe you should post your code. From what you've already posted, the only suggestion I can make is srand((unsigned int)time(NULL));
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  5. #5
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    It sounds like you have a variabled declared called time. You can't have a variable with the same name as a function.

    But like everyone else said, post you're code. You're coming here looking for help; at least make it as easy for us to help you as possible.
    If you understand what you're doing, you're not learning anything.

  6. #6
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    u were right.. I named a variable time. I changed it to something else, and it works fine. thx a lot!!!
    wow, i'm surprised by how many ppl are willing to help. thx a bunch to everyone =)

  7. #7
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by itsme86
    It sounds like you have a variable declared called time.
    Yum...sounds like the voice of experience.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  8. #8
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Quote Originally Posted by pianorain
    Yum...sounds like the voice of experience.
    Unfortunately, yes
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. srand() in .Net
    By Sad Programmer in forum C++ Programming
    Replies: 6
    Last Post: 07-28-2003, 05:01 PM
  3. Same seed for srand yields different results
    By codegirl in forum C++ Programming
    Replies: 3
    Last Post: 06-23-2003, 02:39 PM
  4. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM
  5. srand()... possible reasons for failure
    By lightatdawn in forum C++ Programming
    Replies: 3
    Last Post: 12-18-2001, 02:33 AM