srand and rand are 'pseudorandom number generator'.
srand means 'seed random' and is usually used with 'time(NULL);'
srand(time(NULL)); //Guarantees, that you won't get the exact same row of numbers twice.
rand()%100; //For example.
Regarding that input problem of yours: It's like rolling a dice.
Let's say you assume numbers from 0-99 (%100), you say 'ItemID 1' for results < 10.
In this context, that means a chance of 10 %.
rand is not the most reliable random number generator and should not be used for cryptographic issues (since the rows are mathematically predictable), but for games it should work just fine.
Does that help?
Ah yes, speaking in code.
srand(time(NULL)); //Initializes the random number generator. (Call once)
randID(1, 5, 0.1, 0.2); //Assuming some parameters here
void randID(int level, int diff, float wepChance, float armChance) {
int Rand = rand()%100;
wepChance *= 100; //Maximum dice roll for a weapon
armChance = wepChance + (armChance * 100); //Maximum dice roll for an arm.
if(Rand <= wepChance) //doWeapon
else if(Rand > WepChance && Rand < armChance) //doArm
}
This is untested and rather crude code, but I think you know what I'm getting at.
After all, I don't quite know exactly what you mean to do.