Hey Guys after analysing the multitude of responses I finally went with the
shortest code!
It works perfect & fast, thats all I needed
repeat until the number of items in tRnum = 5
set randomSeed to random(1)
put random(10) into tRand
if tRand is not among the items of tRnum then put tRa
On Jan 28, 2005, at 11:08 AM, Michael D Mays wrote:
What does it mean to sort "1,2,3,4,5" by 12?
Maybe it should be
sort items of x numeric by random(1)
Yes! Sorry about that.
I think sort by 12 effectively means to associate 12 with each item and
then sort by the associated value. The so
What does it mean to sort "1,2,3,4,5" by 12?
Maybe it should be
sort items of x numeric by random(1)
?
Michael
On Jan 27, 2005, at 4:21 PM, Dar Scott wrote:
On Jan 27, 2005, at 2:31 AM, D.Rothe wrote:
How can I include only unique numbers?
Here is an interesting variation:
on mouseUp
put r
If you are asking the random of a big number then that will be true.
I think I remember that to generate a list of random numbers what you
should be doing is asking questions like
random(N)
random(N-1)
.
.
.
1
If you wanted to generate a random list with the numbers 1 thru 10
random(10) -> 3
Now
Hi Dwane,
> I am using the following code to generate a field of 6 random numbers.
>
> repeat 5 times --generate list of 5 random numbers between 1-10
> put random(10) & "," after tRnum
> end repeat
> delete last char of tRnum --delete last comma
> put tRnum into fld "numbers"
>
> this works fine b
Message: 17
Date: Thu, 27 Jan 2005 15:21:09 -0700
From: Dar Scott <[EMAIL PROTECTED]>
Subject: Re: Random #'s
To: How to use Revolution
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On Jan 27, 2005, at 2:31 AM, D.Rothe wrote:
How c
On Jan 27, 2005, at 2:31 AM, D.Rothe wrote:
How can I include only unique numbers?
Here is an interesting variation:
on mouseUp
put rlist()
end mouseUp
function rlist
put "1,2,3,4,5,6,7,8,9,10" into x
sort items of x by random(1)
return item 1 to 6 of x
end rlist
Dar
***
Dwayne,
I'm sure there's a better way to do it, but how about this...
function makeRandomNumberList maxNumber
put 0 into i
repeat
put random(10) into thisNum
if thisNum is among the items of fNumbers then
next repeat
end if
add 1 to i
put thisNum into item i of fNumb
Hi Dwayne,
put GenerateRandom(6,10) -- the right parameters in your case
function GenerateRandom pHowMuchNumbers,pRange
local tRangeList
-
repeat until the number of lines of tRangeList = pHowMuchNumbers
set the randomSeed to random(10)
put random(pRange) into pNum
if pNum
Message: 19
Date: Thu, 27 Jan 2005 19:31:39 +1000
From: "D.Rothe" <[EMAIL PROTECTED]>
Subject: Random #'s
To:
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"
Hi All,
I am using the following code to generate a fiel
On 27 Jan 2005, at 11:25, Mark Smith wrote:
How about something like:
repeat until the number of items in tRnum = 5
put random(10) into tRand
if tRand is not among the items of tRnum then put tRand & comma after
tRnum
end repeat
Although I'm sure this is fine in practice, this kind of solution
a
> Hi All,
> I am using the following code to generate a field of 6 random numbers.
>
> repeat 5 times --generate list of 5 random numbers between 1-10
> put random(10) & "," after tRnum
> end repeat
> delete last char of tRnum --delete last comma
> put tRnum into fld "numbers"
>
> this works fin
How about something like:
repeat until the number of items in tRnum = 5
put random(10) into tRand
if tRand is not among the items of tRnum then put tRand & comma after
tRnum
end repeat
Cheers,
Mark
On 27 Jan 2005, at 10:34, [EMAIL PROTECTED] wrote:
repeat 5 times --generate list of 5 random numbe
Here's one way to do it, with a button-script:
(B
(Bon mouseUp
(B repeat
(Bif the number of lines in tResult > 5 then exit repeat
(Bput random(10) into tRand
(Bif tRand is not among the lines of tResult then
(B put tRand & cr after tResult
(Bend if
(B end repeat
(B
Hi All,
I am using the following code to generate a field of 6 random numbers.
repeat 5 times --generate list of 5 random numbers between 1-10
put random(10) & "," after tRnum
end repeat
delete last char of tRnum --delete last comma
put tRnum into fld "numbers"
this works fine but some numbers
15 matches
Mail list logo