How to use the rand_hard () function?

Requests regarding how to set up experiments in ARGoS.
AntonioC
Posts: 48
Joined: Mon Aug 30, 2021 7:02 pm

How to use the rand_hard () function?

Postby AntonioC » Tue Nov 02, 2021 5:22 pm

When the function is called what is the range of possible return values? Is it possible to change the range of values?

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: How to use the rand_hard () function?

Postby pincy » Tue Nov 02, 2021 5:39 pm

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().
I made ARGoS.


Return to “How to... ?”