home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / hugs_1 / demos_hs_Random < prev    next >
Encoding:
Text File  |  1996-08-12  |  354 b   |  14 lines

  1. -- Generate a list of random numbers of length n
  2.  
  3. import Gofer
  4.  
  5. randoms :: Int -> [Int]
  6. randoms  = iterate (\seed-> (77*seed+1) `rem` 1024)
  7.  
  8. rand100  = sort (take 100 (randoms 1000))   -- a sample distribution
  9.  
  10. adjs []  = []                               -- a list of pairs of adjacent
  11. adjs xs  = zip xs (tail xs)                 -- elements in a list
  12.  
  13.  
  14.