This is a follow on from a previously posted question:
How to generate a random number in C?
I wish to be able to generate a random number from within a part
Wouldn't you just do:
srand(time(NULL)); int r = ( rand() % 6 ) + 1;
% is the modulus operator. Essentially it will just divide by 6 and return the remainder... from 0 - 5
%