[racket] [BULK] Fundamentals

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Wed Oct 13 23:06:50 EDT 2010

On Oct 13, 2010, at 7:29 PM, Mathew Kurian wrote:

> -- Is Racket an interpreted language? If not, how does it convert  
> to machine/binary code?
As you know, Racket evolved from Scheme, which evolved from Lisp,  
which in its earliest implementations (fifty years ago) was  
interpreted rather than compiled.  This has led many people to assume  
that ALL Lisp/Scheme/Racket implementations must be interpreted  
rather than compiled, even though that hasn't been true for decades.
> -- In general computing, how does the random function work? How can  
> computer language ever create random numbers, that would be  
> impossiible?
No, it's not impossible.  If you want truly random numbers, you  
attach your computer to a Geiger counter, or a cosmic ray counter, or  
something like that.  But that's expensive and slow.  So most "random  
number generators" are actually completely deterministic.  For example,

(local [(define seed 27)
             (define (next-random limit)
                   (begin (set! seed (remainder (+ (* seed 13) 5) 473))
                                (remainder seed limit)))]

builds a function that "acts random": since the seed is hidden,  
there's no obvious way of predicting the next answer from the  
previous answer.  (I just made up the numbers 27, 13, 5, and 473; in  
fact, there are lots of research papers on how to choose such numbers  
to make the results as random-looking as possible.)

Stephen Bloch
sbloch at adelphi.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101013/d10fdce3/attachment.html>

Posted on the users mailing list.