comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: more for-loops vs. arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: more for-loops vs. arrays [message #19340 is a reply to message #19337] Wed, 08 March 2000 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Brian Reardon (reardonb@my-deja.com) writes:

> I also have a For-loop vs. array question.
> I want to fill an array with a random sequence of
> 1's and 0's. This works:
>
> array1 = intarr(5,4)
> for I=0,4-1 do begin
> for II=0,5-1 do begin
> array1[II,I] = round(randomu(s))
> endfor
> endfor
>
> but can I do it without for loops?

My Goodness! Here is one even *I* know how to do. :-)

Print, Floor( RandomU(seed, 5, 4) * 2 )

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: interpolation around a contour
Next Topic: Re: How do you get rid of for-loops with arrays

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 07:34:52 PDT 2025

Total time taken to generate the page: 0.40316 seconds