wu :: forums « wu :: forums - Random numbers » Welcome, Guest. Please Login or Register. Feb 27th, 2024, 1:14am RIDDLES SITE WRITE MATH! Home Help Search Members Login Register
 wu :: forums    riddles    medium (Moderators: william wu, towr, SMQ, Grimbal, ThudnBlunder, Icarus, Eigenray)    Random numbers « Previous topic | Next topic »
 Pages: 1 Reply Notify of replies Send Topic Print
 Author Topic: Random numbers  (Read 3546 times)
Altamira_64
Junior Member

Posts: 116
 Random numbers   « on: Jul 29th, 2013, 6:39am » Quote Modify

Get two random numbers between 0 and 1. Subtract the smaller from the bigger. What is the probability that the result is <0.3? Is it bigger than the probability it is > or equal to 0.3?
For what number the probability for both cases is the same?
 IP Logged
towr
wu::riddles Moderator
Uberpuzzler

Some people are average, some are just mean.

Gender:
Posts: 13730
 Re: Random numbers   « Reply #1 on: Jul 29th, 2013, 8:56am » Quote Modify

Nicely chosen parameters. But easy enough when you draw it.
You have a strip along the diagonal of the square where the difference is less than 0.3, leaving two triangles with side 0.7 at opposite corners, which together add to .72 = .49 chance that the difference is greater than 0.3 So the chance of <0.3 is only just greater than >0.3, by 2%
 « Last Edit: Jul 29th, 2013, 8:57am by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Altamira_64
Junior Member

Posts: 116
 Re: Random numbers   « Reply #2 on: Jul 29th, 2013, 11:06am » Quote Modify

Can you draw this?
 IP Logged
towr
wu::riddles Moderator
Uberpuzzler

Some people are average, some are just mean.

Gender:
Posts: 13730
 Re: Random numbers   square.dist.0.3.pdf « Reply #3 on: Jul 29th, 2013, 11:27am » Quote Modify

See attachment.
 IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Altamira_64
Junior Member

Posts: 116
 Re: Random numbers   « Reply #4 on: Jul 29th, 2013, 11:59am » Quote Modify

Great, thanks!
 IP Logged
EdwardSmith
Junior Member

Posts: 61
 Re: Random numbers   « Reply #5 on: Jul 16th, 2014, 2:16am » Quote Modify

begin
for i := 1 to bignumber do
begin
a:= random(1);
b:= random(1);
if a > b then
c:= c+(a-b)
else
c :=c+(b-a);
end;
average := := c/bignumber;
if average < 0.3 then
writeln("yes")
end;

*** error unknown variable on line 2 ***
 « Last Edit: Jul 16th, 2014, 2:37am by EdwardSmith » IP Logged

Schottland Pension
towr
wu::riddles Moderator
Uberpuzzler

Some people are average, some are just mean.

Gender:
Posts: 13730
 Re: Random numbers   « Reply #6 on: Jul 16th, 2014, 9:04am » Quote Modify

Is that pascal?

In any case, the answer should be a probability, not "yes" or nothing.
 IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Grimbal
wu::riddles Moderator
Uberpuzzler

Gender:
Posts: 7526
 Re: Random numbers   « Reply #7 on: Jul 16th, 2014, 9:34am » Quote Modify

A pascal program should start with "program <name>;".  But maybe that is optional.

I think it is meant as pseudo-code.  The variables are not declared, c is not initialized and there is a suspicious double :=.

Anyway, the program computes the average distance between the 2 random numbers, not how often that difference is larger than 0.3.  So it definitely doesn't answer to the question.
 « Last Edit: Jul 16th, 2014, 9:35am by Grimbal » IP Logged
towr
wu::riddles Moderator
Uberpuzzler

Some people are average, some are just mean.

Gender:
Posts: 13730
 Re: Random numbers   « Reply #8 on: Jul 16th, 2014, 10:31am » Quote Modify

on Jul 16th, 2014, 9:34am, Grimbal wrote:
 I think it is meant as pseudo-code.
Yeah, but then what's up with the "*** error unknown variable on line 2 *** ", that makes me think some compiler or interpreter threw an error.

Quote:
 Anyway, the program computes the average distance between the 2 random numbers, not how often that difference is larger than 0.3.  So it definitely doesn't answer to the question.
Maybe if you also had the variance.
 IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Grimbal
wu::riddles Moderator
Uberpuzzler

Gender:
Posts: 7526
 Re: Random numbers   « Reply #9 on: Jul 17th, 2014, 3:12am » Quote Modify

Yes, the error message also bothered me.
It looks like Edward used an IDE to type it but did not go as far as making it a valid program.
 IP Logged
 Pages: 1 Reply Notify of replies Send Topic Print

 Forum Jump: ----------------------------- riddles -----------------------------  - easy => medium   - hard   - what am i   - what happened   - microsoft   - cs   - putnam exam (pure math)   - suggestions, help, and FAQ   - general problem-solving / chatting / whatever ----------------------------- general -----------------------------  - guestbook   - truth   - complex analysis   - wanted   - psychology   - chinese « Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board