Thread: randomize();

  1. #1
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787

    randomize();

    sometimes when i put randomize() in a loop it doesnt work... why?
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: randomize();

    Originally posted by major_small
    sometimes when i put randomize() in a loop it doesnt work... why?
    What exactly is "doesn't work"?

    First off, "randomize" is compiler specific (read: Borland).
    Second, "randomize" is basicly the same thing as "srand", and as such, should only be called once per program execution.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    195
    well, first you have to srand(time(NULL)) so you get a new number every time and in vc++

    its #include <stdlib.h>

    rand()%number;

    which gives you a random number from 0-number

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    82
    randomize() has a very wide range in usage so "doesn't work" won't really mean anything.

    Care to share some code?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. randomize array blackjack c program
    By bazzano in forum C Programming
    Replies: 4
    Last Post: 09-01-2005, 02:05 PM
  2. don't want to randomize two alike numbers
    By randomizer in forum C++ Programming
    Replies: 8
    Last Post: 05-26-2005, 07:42 PM
  3. randomize hex digits
    By wazilian in forum C Programming
    Replies: 3
    Last Post: 12-14-2002, 03:20 AM
  4. Problem with Visual C++ ( randomize function )!
    By marCplusplus in forum C++ Programming
    Replies: 2
    Last Post: 12-17-2001, 01:01 PM
  5. Randomize Number Function
    By beyonddc in forum C Programming
    Replies: 3
    Last Post: 12-10-2001, 04:31 AM