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.
Author: Jason Hill
  David Gay
  Philip Levis
  Alec Woo
Modified: 6/25/02

Components providing this interface:
tos.system.RandomLFSR

Components requiring this interface:
apps.TASKApp.Field
apps.TestTinyViz.TestTinyVizM
tos.lib.TinyDB.TupleRouterM
tos.lib.TinySec.TinySecM
tos.lib.VM.components.BVirus
tos.lib.VM.opcodes.OPrandM
tos.platform.mica.ChannelMonC
tos.platform.mica.MicaHighSpeedRadioM
tos.platform.mica.MicaHighSpeedRadioTinySecM

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.