Contiki 3.x
Functions
random.c File Reference

    Random number generator routines exploiting the cc2430 hardware
    capabilities.
More...

#include "cc2430_sfr.h"
#include "dev/cc2430_rf.h"

Go to the source code of this file.

Functions

unsigned short random_rand (void)
 Generates a new random number using the cc2430 RNG. More...
 
void random_init (unsigned short seed)
 Seed the cc2430 random number generator. More...
 

Detailed Description

    Random number generator routines exploiting the cc2430 hardware
    capabilities.
    This file overrides core/lib/random.c.
Author
George Oikonomou - oikon.nosp@m.omou.nosp@m.@user.nosp@m.s.so.nosp@m.urcef.nosp@m.orge.nosp@m..net

Definition in file random.c.

Function Documentation

void random_init ( unsigned short  seed)

Seed the cc2430 random number generator.

Parameters
seedSeed value for the RNG.
        If the SEED argument is 0, seed the RNG with IF_ADC as
        discussed in the cc2430 datasheet (rev. 2.1), section 13.11.2.2,
        page 134. Seeding with this method should not be done during
        normal radio operation. Thus, use this function before
        initialising the network.

        If the SEED is provided, seed with this value instead. This will
        result in the same sequence of random numbers each time the node
        reboots. So, don't use it unless you have a reason (e.g. tests)

Definition at line 73 of file random.c.

References cc2430_rf_command().

unsigned short random_rand ( void  )

Generates a new random number using the cc2430 RNG.

Generate the next state and return the upper part of it.

Returns
The random number.

Definition at line 50 of file random.c.