Go Down

Topic: Random function is misleading (Read 797 times) previous topic - next topic

tatien

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:

1) That the random() functions in Arduino return integers (16 bits)
or
2) That they make use of the random() / srandom() functions from stdlib.h which return long integers.

mellis


Go Up