From: Paul Lutus Date: 2006-11-15T02:20:07+09:00 Subject: Re: lib - generating a list of random number Josselin wrote: > I try to generate an array of N random numbers in range between 2 > integers min and max > but I don't understand very well how to coordinate the sue of srand and > rand.. They are very easy to use, but first you have to decide what you want to do. What do you want to do? What role does "srand()" play? Be specific. > is there an already written function for that ? For what, specifically? The range of random numbers, or the use of "srand()"? If you always want the same sequence of random numbers, then there is one solution, but if you always want a different sequence, there is a different solution. Which do you want? > and btw is there any > place to find such useful functions ? There sure is: http://www.ruby-doc.org/ By the way, when you ask a question like this, it is best to express your requirement as specifically as possible. You may have noticed that you got two different replies to your inquiry, each with sample code that provided differing interpretations of your request. The solution to this problem is to leave no doubt about your requirement. For example, when you say "between two integers" do you mean: a < n < b or a <= n <= b or some third possibility? -- Paul Lutus http://www.arachnoid.com