Could some one please give me the simplest code for psuedo-random
number generator. I am pressed for time, and the professor asked us to
look it up on the internet. I found several but not really familiar
with the functions being used. My assignment just asks for 5 digits
random number everytime that function is called. I would really
appreciate your help. We are using clisp in the university's lab.
Jolly
·············@hotmail.com
(posted and mailed)
·······@hotmail.com (Jolly) writes:
> Could some one please give me the simplest code for psuedo-random
> number generator. I am pressed for time, and the professor asked us to
> look it up on the internet. I found several but not really familiar
> with the functions being used. My assignment just asks for 5 digits
> random number everytime that function is called. I would really
> appreciate your help. We are using clisp in the university's lab.
Strange, in literally about 45 seconds on Google I was able to find
software that would do *exactly* what you want:
http://lost-contact.mit.edu/afs/cs.cmu.edu/project/ai-repository/ai/lang/lisp/code/math/random/random.cl
Of course, you have to read the code to find the particular function
in this package that will meet your requirement.
* (r:seed-state)
* (dotimes (i 100) (print (<figure out what goes here yourself> 10000 99999)))
68156
37844
18160
58375
42272
35119
61576
92695
17288
87895
72390
63899
82095
42613
16324
44543
30096
42150
12745
21179
79026
17794
54428
32194
64686
12110
53670
90643
47415
64961
43158
11385
32610
83824
94507
86910
14107
59219
97947
13021
71936
59446
73641
69032
79538
26965
41792
45598
39744
66636
88368
77082
52767
16779
52090
35126
53767
71719
54756
50686
94694
59824
41502
20861
80018
38265
70568
60287
14233
12044
87859
77227
50813
19640
44995
65311
11995
33816
73338
12204
76329
91850
53500
56665
61718
45466
97009
69970
78856
92073
96592
24206
31185
47334
75996
87565
39310
51331
13833
92905
NIL
*
--
Fred Gilham ······@csl.sri.com || "If I thought there was anything at
all in your arguments, I should have to be not only a theist, but an
Episcopalian to boot," he said, after one interchange, reckoning that
since Episcopalianism was, in his book, that than which nothing could
be worse, this was an effective reductio ad absurdum. - J. R. Lucas
In article <···························@posting.google.com>,
Jolly <·······@hotmail.com> wrote:
>Could some one please give me the simplest code for psuedo-random
>number generator. I am pressed for time, and the professor asked us to
>look it up on the internet. I found several but not really familiar
>with the functions being used. My assignment just asks for 5 digits
>random number everytime that function is called. I would really
>appreciate your help. We are using clisp in the university's lab.
Read Knuth.
--
Barry Margolin, ··············@level3.com
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
·······@hotmail.com (Jolly) writes:
> Could some one please give me the simplest code for psuedo-random
> number generator. I am pressed for time, and the professor asked us
> to look it up on the internet. I found several but not really
> familiar with the functions being used. My assignment just asks for
> 5 digits random number everytime that function is called.
So your professor asked you to look up code for a random number
generator when the functionality already exists in Lisp?
(defun probably-homework-rng ()
(+ 10000 (random 90000)))
Next week they'll be asking people to look up code for a recursive
function to find the maximum depth of a tree...
Gabe Garza
On 16 Apr 2003 10:51:08 -0700, Jolly wrote:
> Could some one please give me the simplest code for psuedo-random
> number generator. I am pressed for time, and the professor asked us to
> look it up on the internet. I found several but not really familiar
> with the functions being used. My assignment just asks for 5 digits
> random number everytime that function is called. I would really
> appreciate your help. We are using clisp in the university's lab.
(defun answer-to-assignment ()
83742)
--
There is no reason for any individual to have a computer in their home.
-- Ken Olson, President of DEC
(setq reply-to
(concatenate 'string "Paul Foley " "<mycroft" '(··@) "actrix.gen.nz>"))