randon numbers...
As pcmattman more or less said: A polynomial is a function like f(x) = a_n * x^n + a_(n-1) * x^(n-1) + ... + a_1 * x^1 + a_0 (Write it down on a paper and this might actually look prettier ). You can insert a value in this function and get a value in return. Now you are searching the x's (this is not only one x, there are more in this case) for which the return value is 0. They are seeking the smallest x for which f(x) is 0.
The "real" means "real number" in contrast to e.g. complex number (which would make the question just more anoying , but then the number of x for which f(x) is 0 would be more predictable *g*).
The "real" means "real number" in contrast to e.g. complex number (which would make the question just more anoying , but then the number of x for which f(x) is 0 would be more predictable *g*).
http://en.wikipedia.org/wiki/Polynomial
Alternative definition: A numerate parrot (shamelessly copied from the 'Polygon' joke)
Alternative definition: A numerate parrot (shamelessly copied from the 'Polygon' joke)
For random numbers, you can use LFSR's. Linear feedback shift registers can be implemented in hardware or software. Essentially you start out with your 'seed', which is x bits long. every iteration you shift the seed one bit, take the bit that just fell off the end, XOR it with some of the other bit positions (this is statically defined, there are set patterns to get true pseudorandomness), and feed that back in as the MSB. This has been proven to be pseudorandom in the average case, and is dead easy to implement.
I implemented it in hardware and interfaced it to a Z80 system no problems. I had it clocking at 2MHz, more than enough to get some decent random numbers.
I implemented it in hardware and interfaced it to a Z80 system no problems. I had it clocking at 2MHz, more than enough to get some decent random numbers.
A function is a polynomial 'in x' if it can be written as a sum, each term of which is of the form:
Where a, n are constants.
So, for example:
Is a polynomial.
JamesM
Code: Select all
n
a x
So, for example:
Code: Select all
f(x) = 3 + x^2 + 3x^3 + 83x^4
JamesM
Oh the horror, these complicated mathematical equations would meet me too in OSdev?
If you want to get random 16-bit number, you can use this:
Untested, but should work.
Regards
inflater
If you want to get random 16-bit number, you can use this:
Code: Select all
mov al,0
out 43h,al
in al,40h
mov ah,al
in al,40h
Regards
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
It wouldn't be random. If you asked for a series of random numbers you get a linearly ascending function, which is quite predictable.inflater wrote:If you want to get random 16-bit number, you can use this:Code: Select all
mov al,0 out 43h,al in al,40h mov ah,al in al,40h
In other words, a timer isn't a source of entropy, thus it can not be used as a source for truly random numbers.
The timer can however be used for converting entropy from another source - keyboard and mouse interrupts are unpredictable because they are generated by a human source, with minor variances. by looking up the pit counter each interrupt and taking the bottom bits you can change the temporal entropy generated by the computer user into a binary one.
Good one for everybody who has an AM receiver in their computers. Not standard issue thoughbinutils wrote:noise -> computer
Reincarnation, I've missed this one:
Regards
inflater
Of course I did too But when I see some big equations I always say "that must be hard"... even if it isn'tJamesM wrote:Errrr, I studied polynomials when I was 14 (at school)...
Regards
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
I really like the mathematical\theoretical side of computer science. I'm currently looking into boolean algebra a bit, along with some linear algebra.inflater wrote:Of course I did too But when I see some big equations I always say "that must be hard"... even if it isn'tJamesM wrote:Errrr, I studied polynomials when I was 14 (at school)...
C8H10N4O2 | #446691 | Trust the nodes.