how to creat random number?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I am using WICED SDK 3.7.0 and I want to creat some random number.I try

srand(time(NULL));

uint8_t value = rand()%255;

but I get error lib/thumb/v7em\libc.a(lib_a-gettimeofdayr.o): In function `_gettimeofday_r':

c:\pf8_3\Wiced-Tool-Source\ARM_GNU\newlib-build\arm-none-eabi\thumb\v7em\newlib\libc\reent/../../../../../../../newlib-2.0.0/newlib/libc/reent/gettimeofdayr.c:71: undefined reference to `_gettimeofday'

tools/makefiles/wiced_elf.mk:240: recipe for target 'build/' failed

If I block the srand(time(NULL));  the target can be made without error but the value is the same .Can somebody tell me how to creat random value?THS!

0 Likes
1 Solution
AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

wiced_result_t wiced_crypto_get_random( void* buffer, uint16_t buffer_length )

View solution in original post

3 Replies
AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

wiced_result_t wiced_crypto_get_random( void* buffer, uint16_t buffer_length )

Anonymous
Not applicable

For any API related queries I request you to go through the following API.html file which is provided with the SDK. It is in doc folder in the installation path. For Example

>> file:///C:/Users/rash/Documents/WICED/WICED-SDK-3.7.0/WICED-SDK/doc/API/wiced__crypto_8h.html#a3b75a8417089c7fa904422874c25c255

Please check wiced_crypto.h file in include folder of the SDK.

Anonymous
Not applicable

thanks a lot!

0 Likes