Jay Sprenkle wrote: > > On 11/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > -------- Original Message -------- > > > Subject: Re: [sqlite] optimizing out function calls > > > From: Jay Sprenkle <[EMAIL PROTECTED]> > > > Date: Mon, November 14, 2005 4:34 pm > > > To: sqlite-users@sqlite.org > > > > > > > - the random function in C has no arguments, it will produce > > > > a different result on every call (within the limits of the > > > > random number generator that is used). Of course from a > > > > mathematical point of view this is a monstrosity ;). > > A monstrosity? Isn't that a bit emotionally over the top? >
I did add ";)" > A random number generator should generate random numbers and > they aren't supposed to be the same. It does generate the same > sequence of numbers each time given the same seed so it's testable. > Yes, but the implementation (not the definition) as a function a la C causes it to deviate from the mathematical concept of a function. > > > > But 'random' is not a mathematical function. In software we often use > > functions to get values from the outside world ( getch(),time() etc, > > etc). Random is a function which fetches the next number from a random > > number generator. The qualities of that random number depend on the > > underlying generator. When we pass an argument to random it is just to > > control the behaviour of the random number generator. > > > > We would not expect getch() and time() to return the same result each > > time they are called (except on friday afternoons). > > I think that's why DRH doesn't cache results for user defined functions. Again, the implementation of getch and time as _C functions_ is a pure implementation choice. Other languages do it in another way. The whole point I was trying to make is that the apparent implementation form of some functionality may be misleading as to its proper semantics. Regards, Arjen