Вопрос

Is there a thread-safe RNG in Bionic? For Linux, I know there is rand_r(), but this is unfortunately not a part of the NDK.

Это было полезно?

Решение

You can simply read from /dev/urandom/ to get pseudo-random bytes. If you need this for cryptographic purposes, you may want to look into OpenSSL as well.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top