1 //******************************************************************
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
13 #if defined(__ANDROID__) || defined(__linux__)
16 //#include <Arduino.h>
17 //#include <wiring_analog.c>
18 #define ANALOG_IN (15)
22 * Seed the random number generator. Seeding depends on platform.
23 * Android and Linux uses current time. Arduino uses Analog reading on pin ANALOG_IN
24 * @retval 0 for Success, otherwise some error value
26 int8_t OCSeedRandom();
29 * Generate a uniformly [0,2^32] distributed random number
30 * @retval On Success, it returns the random value.
32 uint32_t OCGetRandom();
35 * Generate a uniformly [0,2^8] distributed random number
36 * @retval On Success, it returns the random value, otherwise -1 for error.
38 uint8_t OCGetRandomByte(void);
41 * Generate a uniformly distributed 8-bit (byte) array random numbers
42 * @param[out] location
43 * memory location to start filling with random bytes
45 * length of array to be filled with random bytes
47 void OCFillRandomMem(uint8_t * location, uint16_t len);