Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.Random.nc

Interface: Random

This is the interface to a simple pseudorandom number generator. Currently this interface is implemented by the RandomLFSR, which uses a linear feedback shift register to generate the sequence and mote address to initialize the register.

Components providing this interface:
tos.system.RandomLFSR

Components requiring this interface:
tos.lib.TinyDB.NetworkC
tos.lib.TinyDB.TupleRouterM
tos.platform.mica.ChannelMonC
tos.platform.mica.MicaHighSpeedRadioM

Commands

Commands - Details

init

result_t init(void)

Initialize the random number generator
Returns: Returns SUCCESS if the initialization is successful, or FAIL if the initialization failed. For the currently existing implementations there is no known faliure modes.

rand

uint16_t rand(void)

Produces a 16-bit pseudorandom number.
Returns: Returns a 16-bit pseudorandom number.