Hello, i’m having some issue getting a random number between 0 and n-1 (the max size of my array), i saw the rand is getting the max from the RAND_MAX, but this value cannot be modified because it is a constant.
sorry for this question (i’m new to c++), but i need some clues or tips on how to get a random number given the min and a max value as a parameter, i think this can be done in c++ but i don’t know how.
Yes. As the RandRange comment mentions, it is inclusive (“Returns a random number >= Min and <= Max”). So Max-1 will properly limit returned values to the range of your array indices.