RE: Random Numbers fasters than the osax
RE: Random Numbers fasters than the osax
- Subject: RE: Random Numbers fasters than the osax
- From: Olof Hellman <email@hidden>
- Date: Thu, 28 Mar 2002 13:44:08 -0800
Perhaps the easiest solution for you would be an OSAX that returns a list of
random numbers, so that instead of getting one at a time, you can ask for a
list of 10 or 20 at a time ( there's probably an optimum value between 10
and 1000 somewhere, assuming that getting an item out of a list is faster
than calling an osax ). That would be an easy OSAX to write, and might make
all the difference for you.
- Olof
Michael Sullivan wrote:
>
I've just had the brilliant idea to write some ad hoc monte carlo sims
>
in applescript since I'm getting really comfortable with it. For the
>
kind of accuracy I'm looking for, it has the potential to be
>
plenty fast
>
enough, except for one thing. I need to generate a lot of random
>
numbers -- that's an osax which takes about 10 times as long as a
>
vanilla instruction, making it *just* slow enough that a
>
useful sim for
>
what I'm looking at might take an hour or two to run, instead of maybe
>
10 minutes.
>
>
That's not a huge deal, but I'm wondering if one of you math wiz folks
>
has a vanilla random number generator handy, or a suggestion on how to
>
build one. I can probably come up with decent hash functions
>
by digging
>
through some of my old algorithms books, but the only good changing
>
number I can think to seed it with is ticks, which is another osax --
>
and to get real random numbers I'd need to reseed every time, no?
>
>
Am I missing some really cool trick to making this work fast, or do I
>
just have to live with either slow execution or coding it in C?
>
>
>
Michael
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.