If you have a program that randomly selects say 5 words from a list of 20 or w/e how do you errortrap it or w/e so that the same word is not picked twice?
Thanks so much!
<3
Ps. This is my friends thing and this is her code for it I can't really explain it but here it is if it helps.
var num : int
var Tim3 : int := 1
var words : array 1 .. 20 of string (15) := init ("1)Amazing", "2)Banana", "3)Cherries", "4)Dance", "5)Elephant", "6)Fantastic", "7)Game", "8)Ice", "9)Kangaroo", "10)Love", "11)Marshmallow","12)Octopus", "13)Pig", "14)Rainbow", "15)Strawberries", "16)Turtle", "17)Umbrella","18)Violin","19)Xylophone","20)Wiggle")
for x : 1 .. 10
Tim3 := Tim3 + 1
randint (num, 1, 20)
put words (num)
delay (1000)
exit when Tim3 = 11
end for
Archived topic from Iceteks, old topic ID:3038, old post ID:24964
Woah this is really important!
- Red Squirrel
- Posts: 29209
- Joined: Wed Dec 18, 2002 12:14 am
- Location: Northern Ontario
- Contact:
Woah this is really important!
I would just use an if statement to ensure value A is not equal to B C D or E then make sure B is not equal to A C D or E etc.... there's probably a better way of doing it though.
Archived topic from Iceteks, old topic ID:3038, old post ID:24965
Archived topic from Iceteks, old topic ID:3038, old post ID:24965
Honk if you love Jesus, text if you want to meet Him!
Woah this is really important!
Thank anyways!
Archived topic from Iceteks, old topic ID:3038, old post ID:24966
Archived topic from Iceteks, old topic ID:3038, old post ID:24966