something fishy in mathematica random generation?
- To: mathgroup at smc.vnet.net
- Subject: [mg33097] something fishy in mathematica random generation?
- From: KIMIC Weijnitz Peter <micweij at eka.ericsson.se>
- Date: Sun, 3 Mar 2002 06:30:16 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I hope someone can explain this.
A characteristic of a truly random behavior is that events tend to
cluster.
E.g. a molecular collision is more likely to occur just after the most
recent collision.
or, in a bit stream, a bit error is more likely to occur just after the
most recent error if the errors are generated by random noise.
I simulated this with a generated vector with ones and zeroes with a
given probability using Random and RandomSeed in Mathematica 3.01. and I
found something peculiar with the random generation in Mathemathica,
Just run these lines and see for yourself:
SeedRandom[1111111 ] (*change this number to get another random
sequence*)
vec1=Table[Random[Real,{0,1000}],{10^6}]; (*reduce this
vector length if you get memory problem*)
vec2=Map[If[#<44,1,0]&,vec1]; (*threshhold for
ones*)
ones=Flatten[Position[vec2,1]]; (*vector of index
positions for ones *)
Length[ones]/10.^6 (*check for the
average of ones*)
plotvec=Map[Length,Split[Sort[Drop[ones-RotateRight[ones,1],1]]]];
(*subtracts ones[[i]]-ones[[i+1]]*)
ListPlot[Log[plotvec],PlotRange->All]
It is the plot that seems a bit strange to me, I get the expected
decreasing exponential behavior in
the probability of the interval length between ones.
But, (this is the question) in all different simulations I have made
with different RandomSeed[], average
of ones, different vector length, the interval of 24 have a lower
frequency than expected.
If this behavior persists when you test, what is the reason?
If not, why do I get it, I have tried it on two computers.
hehe.. if you reverse 24 you get 42???
Peter W
- Follow-Ups:
- Re: something fishy in mathematica random generation?
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: something fishy in mathematica random generation?