|
From: | Gasper Tkacik |
Subject: | [Q]: How to fill an array with random values? |
Date: | Sun, 02 Feb 2003 23:43:18 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021018 |
Hello!I am a first year graduate student at Princeton and am considering using Pooma for cosmological simulations. I have just downloaded and compiled it sucessfully and ran some very simple examples. I have the following question: how do I efficiently (without explicit looping) fill the array with random values?
I browsed through the manuals and the best I could come up with was to define a function Random, overload its () operator, create a
UserFunction<Random> rf and apply it to the array A like this A = rf(A);However, I do not know if this is a good solution. Random does not need any parameter, but I was forced to put in something to conform to the () syntax, so I just put in the same A array. Is there a more elegant solution? I hope the compiler does not generate a temporary copy in the above example?
BTW: Is this list appropriate for such questions or are there only development issues discussed? If the later, I apologize.
Best regards, Gasper.
[Prev in Thread] | Current Thread | [Next in Thread] |