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..
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..
and what you can not accomplish?
selectedword := words[random(high(MAX_WORDS))];
Assuming words array is 0 based like :
words : array [0..MAX_WORDS] of string;
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.