title: random function in scheme
body: <p>I am trying to get a random string from a list of strings in scheme.
  Example List ( "this" "that" "today" "yesterday")
  So based on length of the list a random number is created and that word is output. But keep getting error!</p>
  
  <p>I tried it like this:</p>
  
  <pre><code>;; produces random number that should be input to the random-function
  
  (define (random-num list)
  
  (random-function ((random (length (list))) list)))
  
  ;; loops the number of times till random number is 0 and outputs the list value
  
  (define (random-function num list )
    (cond 
      [(zero? num) (car list)]
      [else (random-function (- num 1) (cdr list))]))
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>procedure application: expected procedure, given: 
  ("this" "that" "today" "yesterday") (no arguments)
  </code></pre>
  
  <p>When I try to do : </p>
  
  <pre><code>(random-function (random (length list)) 
  </code></pre>
  
  <p>on the console I get a random number.</p>
  
  <p>Do not understand why it is crashing here when done inside my program???</p>
  
  <p>Could I do this in a better way rather than looping so many times.
  In Java I would have used an array and given the position directly.
  Anyway to do it in scheme too ?</p>