The random() functions in Arduino lib is misleading. It returns a long integer (32 bits) but it uses the rand() function in avr stdlib.h which returns an int (16 bits). As thus, I would suggest one of the following two options:
- That the random() functions in Arduino return integers (16 bits)
or - That they make use of the random() / srandom() functions from stdlib.h which return long integers.