I am attempting to translate an algorithm that was previously developed and tested in C, into a MATLAB function. This algorithm is used to generate a random number, and depends on the C language behavior of wrap on integer overflow. However, since integers saturate on overflow in MATLAB, the algorithm does not work as expected.
MATLAB: How to force integer operation results to wrap on overflow in MATLAB 7.8 (R2009a)
MATLAB
Best Answer