PDA

View Full Version : Make Random Words


AphexCCFC
06/02/2013, 05:23 PM
How do I make this show random fish names instead of numbers, like "Trout", "Shark", etc:

random(46);

Misiur
06/02/2013, 05:46 PM
stock RandomFish() {
#define TOTAL_FISHES 3;
new fish[TOTAL_FISHES][32] = { "Trout", "Shark", "Swordfish" };
return fish[random(TOTAL_FISHES)];
}

@e: This should work as well
stock RandomFish() {
new fish[3][32] = { "Trout", "Shark", "Swordfish" };
return fish[random(sizeof fish)];
}

Jeffry
06/02/2013, 05:46 PM
new name[25];
switch(random(46))
{
case 0: name = "Fish";
case 1: name = "Trout";
(...)
case 45: name = "Shark";
}

DXM
06/02/2013, 05:50 PM
randomNameFish () {
new fish[][32] = { "Trout", "Shark", "Swordfish" };
return fish[random (sizeof (fish))];
}