I would like to pass a signed int to gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n)
. The signed int that I'm passing is greater than or equal to zero. The function will return a number between 0
and n
, so if I pass it a positive signed int, it will return something that is in the range of a signed int. I then want to store the return value in a signed int. What's the cleanest way to do this with the obvious expected behaviour? I'm on a 64-bit compiler on a 64-bit Linux machine.
Update
Sorry, folks. Please ignore. The problem with my code was actually elsewhere. I misinterpreted the output of gdb
.