Re: Predictible random number nodemcu 1.5.1
Posted:
Mon Jun 27, 2016 10:19 am
by martinayotte
No, I mean the RNDG register that @cicero mentioned link to, the 0x3FF20E44.
I've done a quick test in my Arduino Sketch-Buffet by printing the value of this register, it is working nicely.
Re: Predictible random number nodemcu 1.5.1
Posted:
Mon Jun 27, 2016 10:38 am
by Cicero
martinayotte wrote:No, I mean the RNDG register that @cicero mentioned link to, the 0x3FF20E44.
I've done a quick test in my Arduino Sketch-Buffet by printing the value of this register, it is working nicely.
Sounds good!! It was pointed out to me a few months ago, and I've been keeping it in the back of my mind in case I ever needed it.
Re: Predictible random number nodemcu 1.5.1
Posted:
Mon Jun 27, 2016 2:16 pm
by marcelstoer
NodeMCU contains only a subset of Lua's math module (see
https://github.com/nodemcu/nodemcu-firm ... lmathlib.c). Still, math.random() uses a "
pseudorandom number generator" rather than the hardware random number generator. Using math.randomseed() (
http://lua-users.org/wiki/MathLibraryTutorial) would give you a certain predictability as equal seeds produce equal sequences of numbers.
https://github.com/nodemcu/nodemcu-firmware/pull/1205 didn't get anywhere.