Page 1 of 1

How to use the rand_hard () function?

Posted: Tue Nov 02, 2021 5:22 pm
by AntonioC
When the function is called what is the range of possible return values? Is it possible to change the range of values?

Re: How to use the rand_hard () function?

Posted: Tue Nov 02, 2021 5:39 pm
by pincy
This is something related to the original interface of the Kilobot. The ARGoS model mimicks what the Kilobot originally offers.

The function rand_hard() is implemented with a Mersenne-Twister random number generator that returns a 32 random bits.

It is not possible to change the range, but you can scale the values and add/subtract numbers to achieve the range you need. Refer to the rand() Linux function for possible examples, as its logic is similar to rand_hard().