Post Reply 
An unexpected result involving sums of random numbers
03-02-2023, 10:01 PM
Post: #15
RE: An unexpected result involving sums of random numbers
In Matlab with the following script:
sumcount = 0;
for i = 1:100000
s = 0;
count = 0;
while s <= 1
s = s+random('Uniform', 0,1);
count = count + 1;
end
sumcount = sumcount + count;
end

avgcount = sumcount/100000;

I get:
2.7195
2.7196
2.7190
2.7175
2.7183

Or, much better than yours. Of course this does not really "converge" to e.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: An unexpected result involving sums of random numbers - KeithB - 03-02-2023 10:01 PM



User(s) browsing this thread: 5 Guest(s)