random

Scott Morrow scott at elementarysoftware.com
Sun Mar 12 20:40:34 EST 2006


Try this:

on mouseUp
   put "1a,2a,3a,4a,5a,6a" into tFieldNames
   put empty into tNumList
   repeat for each item tfield in tFieldNames
     put the random of 45 into tRandom
     repeat forever
       if tRandom is not among the items of tNumList then
         put tRandom & comma after tNumList
         put tRandom into fld tfield
         exit repeat
       end if
       put the random of 45 into tRandom -- that number didn't work  
so try another
     end repeat
   end repeat
end mouseUp


-Scott Morrow

Elementary Software
(Now with 20% less chalk dust !)
web     http://elementarysoftware.com/
email   scott at elementarysoftware.com

-----------------------------------------------------------------

On Mar 12, 2006, at 4:52 PM, liamlambert wrote:

> I have this code for a random number in 6
> fld's how do I stop the same number form appearing
> in more then one fld
>
> put "1a,2a,3a,4a,5a,6a" into tFieldNames
>  repeat for each item tfield in tFieldNames
>   put the random of 45 into trandom
>   put trandom into fld tfield
>   end repeat
>
> Liam Lambert
> liamlambert at mac.com
> IRELAND
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list