Re: srand() troubles

From: Merrill & Michele (beckjensen_at_comcast.net)
Date: 09/18/04


Date: Sat, 18 Sep 2004 00:52:03 -0500

snip
> $32 is not a bad price for a good book. (The fact that most programming
> books are crap is a different topic.)
>
> > I would like to announce that my demographic and I would gladly
> > pay $2^6 for a book entitled: Essential Knuth in C. MPJ

Scott Nudds flies out of somebody's hard drive last week and my lamentation
of the lack of goals and direction for this forum and this language are
going to win a "weird" award? I'd bet dollars to donuts that my wholesale
detractors don't know mittelhoch from windloch.

> Knuth is best grasped free of the accidental limitations of any specific
> language. He focuses on algorithm design, and any primitive-recursive
> algorithm can be expressed in any Turing-complete language. There's a huge
> advantage to decoupling algorithms from implementations.
>
> (Plus, C is full of accidental limitations, related to the low-level
> semantics and the popularity of nonstandard extensions. Another great
> book, "Structure and Interpretation of Computer Programs", uses Scheme (a
> minimalistic Lisp dialect) as its pedagogical tool, but its focus is
> different from Knuth's books.)

Thank you for your response. Certainly, one recognizes the value of
algorithms in "programmese." I just find too many gotchas on the road to
getting those programs running on my implementation. srand() is a good
example. I thought I was being all kinds of clever to determine whether the
numbers 0 and 32767 turned up on ensuing rand() calls. I would have
blithely assumed that my code would port in complete ignorance of RAND_MAX.
I doubt that Knuth addresses this, and if K&R does, here's your chance to
say I told you so.

C has limitations, as any language must. I would make the analogy that it
is like Russia, which "the world" shifted away from but now looks poised
very nicely and has extraordinary assests. I'll take a look at that book.
MPJ



Relevant Pages

  • P Versus NP
    ... determine whether every language accepted by some nondeterministic ... algorithm in polynomial time is also accepted by some ... L = Lfor some Turing machine M which runs in polynomial time} The ... We say that R is polynomial-time iff L R ...
    (sci.math)
  • Re: Mr. P and Ms. S
    ... determine whether every language accepted by some nondeterministic ... algorithm in polynomial time is also accepted by some ... L = Lfor some Turing machine M which runs in polynomial time} The ... We say that R is polynomial-time iff L R ...
    (sci.math)
  • Re: pseudo code v/s algorithm
    ... insert your language here) than code. ... There is absolutely no difference between algorithm and code, ... If I have an implementation or pseudo-code it cannot be ... Turing Machine or lambda-calculus in it, modulo the infinite memory ...
    (comp.programming)
  • Re: pseudo code v/s algorithm
    ... insert your language here) than code. ... There is absolutely no difference between algorithm and code, ... If I have an implementation or pseudo-code it cannot be ... just have a look at the sources of some Common Lisp ...
    (comp.programming)
  • Re: pseudo code v/s algorithm
    ... Algorithm is like a thought. ... insert your language here) than code. ... Pseudo-code is just an informal way to express such a mathematical ... Turing Machine or lambda-calculus in it, modulo the infinite memory ...
    (comp.programming)