There is no "fast" way of calculating average of many numbers. Though the
algorithm used for generating random numbers is not exactly "perfect".
There is a probability distribution function involved. If you analyze that
graph, then the descriptive statistics will be approximately same for all
practical purposes. You might find it amazing, but this is the property of
the algorithm. The algorithm Julia uses is called "Mersenne Twister". You
can also plot the curve of Intensity vs number and see for yourself.

This link :
http://blogs.mathworks.com/cleve/2015/04/17/random-number-generator-mersenne-twister/
shows the analysis of the algorithm with the graph

Regards,
Pranit Bauva

On Sat, Jan 2, 2016 at 5:27 PM, paul analyst <[email protected]> wrote:
> I have meny lonng vectors (like a)and need avg for intervals (f.e. 100 )
in
> second new vecotr (b)
>
> julia> a=rand(10^7);
>
> julia> b=zeros(a);
>
> julia> tic();for i in  [1:100:10^7;]
>        b[i:i+99]=mean(a[i:i+99])
>       end;toc()
> elapsed time: 0.138522318 seconds
> 0.138522318
>
> I am looking for more faster way , is any ?
> Paul

Reply via email to