arrays and randomize

Reply

Join Date: Apr 2007
Posts: 9
Reputation: sez90 is an unknown quantity at this point 
Solved Threads: 0
sez90 sez90 is offline Offline
Newbie Poster

arrays and randomize

 
0
  #1
Apr 20th, 2007
hey there, umm so i have an array of words and now i need to be able to randomly choose one of those words when the appropriate button is clicked, its for a hangman game...
i know that
randomize;
goes in there sumwhere...

thanks heaps..
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: arrays and randomize

 
0
  #2
Apr 21st, 2007
and what you can not accomplish?
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 233
Reputation: Lord Soth is an unknown quantity at this point 
Solved Threads: 4
Lord Soth's Avatar
Lord Soth Lord Soth is offline Offline
Posting Whiz in Training

Re: arrays and randomize

 
0
  #3
Apr 23rd, 2007
selectedword := words[random(high(MAX_WORDS))];

Assuming words array is 0 based like :

words : array [0..MAX_WORDS] of string;
Best regards,
Loren Soth

Crimson K. Software _________________________________________________________________ Crimson K. Blog
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1
Reputation: Emelinn is an unknown quantity at this point 
Solved Threads: 0
Emelinn Emelinn is offline Offline
Newbie Poster

Re: arrays and randomize

 
0
  #4
Jul 2nd, 2007
Before calling random function you should call procedure randomize, it will initiate pseudorandom number generator.
It's necessary because without calling procedure randomize you will get the same random sequence
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC