Random generator in OpenCPU

Is there any Random Generator (or specifically Secured Random Generator) available in OpenCPU stack? I want to have some sort of signature algorithm (Specifically ECDSA family) but when trying to use random from stdlib, the app crashed.

Nopeā€¦ conbine seed() with timeā€¦

Hiļ¼Œ Farzin_Ghassemi:
Our opencpu supports random number interface. There are two interfaces of srand and rand under the math.h library. You can use these two random number interfaces with getlocaltime to get the random number you want. Refer to the following code:
` #include <math.h>

ST_Time nw_time;
Ql_GetLocalTime(&nw_time);
APP_DEBUG(ā€œyear:%d month:%d day:%d hour:%d minute:%d second:%d timezone:%d\r\nā€,nw_time.year,nw_time.month,nw_time.day,nw_time.minute,nw_time.second,nw_time.timezone);
srand(Ql_Mktime(&nw_time));
ret = rand()%60 + 1;
APP_DEBUG(ā€œrand:%d\r\nā€,ret);`

thank you.

1 Like

Thnx mate, I have successfully implemented ECC, ECDSA & AES-256 for MC60 and the performance is AWESOME!!!

1 Like