       Re: Re: RandomReplacement

• To: mathgroup at smc.vnet.net
• Subject: [mg51414] Re: [mg51380] Re: RandomReplacement
• From: sean kim <sean_incali at yahoo.com>
• Date: Sat, 16 Oct 2004 04:20:58 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```actually, I made a  mistake in the last post. i forgot
the index for RandomArray. if it's put back in, i get
the similar slowing down effect.

sorry for any confusions. but i noticed something else

without the package loaded, i get

In:= <<"Statistics`NormalDistribution`";

In:= Table[RandomArray[NormalDistribution[50,25],
1],{10^4}];//Timing
Out= {0.992 Second,Null}

In:= Table[RandomArray[NormalDistribution[50,25],
1],{10^5}];//Timing
Out= {9.143 Second,Null}

In:= Table[RandomArray[NormalDistribution[50,25],
1],{10^6}];//Timing
Out= {91.361 Second,Null}

In:= Timing[Table[Random[Real, {0, 100}],{10^6}];]
Out= {0.671 Second,Null}

as Daniel was saying, no secret here. as you increase
the number of samples, you increase the time. it take
10x time to pick 10x more numbers. (lol, to think I
was wondering why that was...)

anyway, obviously using the RandomArray to sample the
number from a distribution is less efficient than just
using Random[]. but that's not what is kinda peculiar
for me.  now if we do the same thing with the

In:=
<<"Statistics`NormalDistribution`";
<<RandomReplacement`

In:= Table[RandomArray[NormalDistribution[50,25],
1],{10^4}];//Timing
Out= {1.221 Second,Null}

In:= Table[RandomArray[NormalDistribution[50,25],
1],{10^5}];//Timing
Out= {11.867 Second,Null}

In:= Table[RandomArray[NormalDistribution[50,25],
1],{10^6}];//Timing
Out= {120.953 Second,Null}

In:=Timing[Table[Random[Real, {0, 100}],{10^6}];]
Out={27.389 Second,Null}

pronounced in using Random[Real, {}] alone.

When I used RandomArray, package slowed things down
1.3 times. (120.953 seconds/91.361 seconds)

but using Random[Real], it slows it down by 40 times!(
27.389 seconds /0.671seconds)

I wonder if this gives you guys soem ideas to speed
things up.

hope that helps a bit.

sean

__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

```

• Prev by Date: NewtonZero never comes down
• Next by Date: Need code to calculate the Lower Envelope for a set of (non collinear) points.
• Previous by thread: Re: RandomReplacement
• Next by thread: Re: RandomReplacement