Re: pseudo random number between X and Y?



On Wed, 18 Nov 2009 15:23:39 -0800 (PST), rickman <gnuarm@xxxxxxxxx>
wrote:

On Nov 18, 5:43 pm, Jon Kirwan <j...@xxxxxxxxxxxxxxxxxxx> wrote:
On Wed, 18 Nov 2009 12:18:20 -0800 (PST), rickman <gnu...@xxxxxxxxx>
wrote:



On Nov 17, 9:33 am, Vladimir Vassilevsky <nos...@xxxxxxxxxxx> wrote:

Abandon this task. It is not for the sorrow programmers like you.

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultanthttp://www.abvolt.com

Even with all the spam I have to parse through on the Google groups
page, I have never considered going back to a newsreader.  But this
might just be a good reason, to be able to killfile someone...  I
wonder who...

But then I am just feeding the troll, so maybe I should killfile
myself...

Rick

I've wondered why he bothers.  It doesn't often appear to be for
teaching anyone.

He has a point if you take his assumptions.  It's kind of a sad
comment on the general state of embedded programming affairs, if you
assume the OP is someone who is charged with the engineering of a
system of RF boards and is then asking about how to generate a random
delay.  The assumption may be false, though.  It's possible this is
someone who knows their application space well but isn't an engineer
-- more of an integrator?? -- and who could use a gentle clue.  It's
also possible that the OP is asking for practical experience and just
stating it poorly.  Still, it does beg a few questions.

Since I've now bothered writing at all, the OP may google up "linear
congruential generator" (LCG) and keep in mind also the basic idea of
a linear expression that yields something within a specified range,
X+(Y-X)*(R-Rmin)/(Rmax-Rmin+1), where the X and Y are his own values
from his post and the Rmax and Rmin are the minimum and maximum values
that the LCG produces.  Rmin is often 0, but not always.  The
expression assumes real numbers.  If integers are exclusively used,
finding an LCG with a nice (Rmax-Rmin+1)=2^N, with N a positive
integer, might help somewhat.  Scaling to produce a desired precision
in milliseconds may also be warranted.  Also, I very much support
another poster's comment about reading Donald Knuth's volume on
Seminumerical Algorithms from the early 1970's (I completely read his
three books, cover to cover including the long discussions on tape
sorting, when they came out and they added a lot to my earlier
education.)

Jon

I don't care what the issue is, VV's approach is rude and accomplishes
nothing. I wish he would just go away unless he is willing to
actually help someone. There are any number of things I am ignorant
about in the field of EE which I have been earning a living in for 30
years. Does that make me stupid? That is why we are here for the
most part I think, to learn things we don't know.

I know that school taught me a lot of basics, but I have learned all
the practical stuff while working. Does that mean my schooling was
lacking?

There are any number of reasons why someone posts angry replies.
Regardless, they reflect badly on the poster and annoy the rest of
us.

Gotcha, Rick, and understood. Largely agreed.

* While I'm at it, to the OP: You can combine the LCG's equation with
the linear one used to provide a chosen range into a single linear
expression with the same operation count as only one would require.
Some care may be needed, though, to retain bits appropriately.

Jon
.



Relevant Pages

  • Re: pseudo random number between X and Y?
    ... might just be a good reason, to be able to killfile someone... ... that the LCG produces. ... I know that school taught me a lot of basics, ... There are any number of reasons why someone posts angry replies. ...
    (comp.arch.embedded)
  • Re: Digital volume control question....
    ... capacitor which must be assumed to be linear for the test to work. ... to be a 'reason' for a claim or belief... ... Audio Misc http://www.st-and.demon.co.uk/AudioMisc/index.html ...
    (uk.rec.audio)
  • Re: Is a Login Form "Tabular Data"
    ... ONLY reason I'm doing it is because it's *considered* a best practice. ... this form is most certainly "tabular data" ... submit buttons) then this is really a more linear and less grid-like ... labels and controls alongside each other. ...
    (comp.infosystems.www.authoring.stylesheets)
  • It is just an iterated line !!!
    ... example 1 P and Q are linear in X, example 2 they are quadratic in X, ... we successively get more terms from the sequence of the Large Schroeder ... but successively better approximations to the sequence's ... The reason for this is that successive terms in each F_i get ...
    (sci.math)
  • Re: a humble request
    ... media. ... is there any particular reason why it is better to have it removed? ... LCG - UFRJ ...
    (Fedora)