

Title: Random numbers Post by Altamira_64 on Jul 29^{th}, 2013, 6:39am 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? 

Title: Re: Random numbers Post by towr on Jul 29^{th}, 2013, 8:56am Nicely chosen parameters. But easy enough when you draw it. [hide]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 .7^{2} = .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%[/hide] 

Title: Re: Random numbers Post by Altamira_64 on Jul 29^{th}, 2013, 11:06am Can you draw this? 

Title: Re: Random numbers Post by towr on Jul 29^{th}, 2013, 11:27am See attachment. 

Title: Re: Random numbers Post by Altamira_64 on Jul 29^{th}, 2013, 11:59am Great, thanks! 

Title: Re: Random numbers Post by EdwardSmith on Jul 16^{th}, 2014, 2:16am begin for i := 1 to bignumber do begin a:= random(1); b:= random(1); if a > b then c:= c+(ab) else c :=c+(ba); end; average := := c/bignumber; if average < 0.3 then writeln("yes") end; *** error unknown variable on line 2 *** 

Title: Re: Random numbers Post by towr on Jul 16^{th}, 2014, 9:04am Is that pascal? In any case, the answer should be a probability, not "yes" or nothing. 

Title: Re: Random numbers Post by Grimbal on Jul 16^{th}, 2014, 9:34am A pascal program should start with "program <name>;". But maybe that is optional. I think it is meant as pseudocode. 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. 

Title: Re: Random numbers Post by towr on Jul 16^{th}, 2014, 10:31am on 07/16/14 at 09:34:59, Grimbal wrote:
Quote:


Title: Re: Random numbers Post by Grimbal on Jul 17^{th}, 2014, 3:12am 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. 

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