Hi,guys! I study about how to generate a random number recently,a lot of articles said "Linear Congruential Generator" is a frequently-used method!However,I used the mothod rand() in the stdlib.h,which is a lib function of keil,I observed it seems as if it don't use this kind of method,do it???
"but i can't read it clearly!"
Seriously? Even a quick glance shows it's an LSFR implementation.
If you don't get that right off the bat, play computer and write down the register values and all the effects of instructions interacting on said registers. Imagine objects of 16 or 32 bits in size being acted upon. Model that in C and it will boil down to a handful of C statements.
Even a quick glance shows it's an LSFR implementation.
It's LFSR, to be exact. Don't let typos confuse the original poster even more. Here is the Wikipedia link: en.wikipedia.org/.../LFSR
There is an artical about keil generates the random with LSFR: http://www.keil.com/forum/docs/thread3202.asp what is : Masks for 3-bit galios LFSR maximum run length generator Masks for 8-bit galios LFSR maximum run length generator Masks for 10-bit galios LFSR maximum run length generator ... Masks for 32-bit galios LFSR maximum run length generator why masks the register?!
"There is an artical about keil generates the random with LSFR"
Indeed - and its first paragraph gives a link to an article explaining the technical details!
If you really want to get into this, then you are going to have to get down to some serious study - it is beyond the scope of this forum!
I understand the LSFR roughly,but seems that keil dosen't use it?!There is no some kind of masks for registers in LSFR?!