Talk:Monty Hall problem: Difference between revisions

From Rosetta Code
Content added Content deleted
(Probability error)
Line 18: Line 18:
The probabilities should tend to 1/3 for sticking with your original guess whereas your result seems to be 1/2 making me think you could have a problem in the Ada program. --[[User:Paddy3118|Paddy3118]] 15:09, 11 August 2008 (UTC)
The probabilities should tend to 1/3 for sticking with your original guess whereas your result seems to be 1/2 making me think you could have a problem in the Ada program. --[[User:Paddy3118|Paddy3118]] 15:09, 11 August 2008 (UTC)
:The number of iterations was simply not enough to get a stable random number generator on a fast machine. I have increased the number of iterations and achieved the expected results.--[[User:Waldorf|Waldorf]] 00:18, 15 August 2008 (UTC)
:The number of iterations was simply not enough to get a stable random number generator on a fast machine. I have increased the number of iterations and achieved the expected results.--[[User:Waldorf|Waldorf]] 00:18, 15 August 2008 (UTC)

== Probability error ==
Several sample outputs are suggesting that the total probability does not equal 100% which can't be right. --[[User:Lupus|Lupus]] 11:38, 5 November 2008 (UTC)

Revision as of 11:38, 5 November 2008

Haskel error on codepad?

I don't know Haskel but following the section header link, I tried to run it on [codepad], unfortunately it gave errors but I don't think I'm qualified to judge if they are true errors or something to do with the version of Haskel used on Codepad etc. Could someone comment and maybe fix things if there is an error? Thanks.

P.S. The error was:

  Error occurred
  ERROR line 26 - Type error in application
  *** Expression     : cars trials True g
  *** Term           : trials
  *** Type           : Integer
  *** Does not match : Int

--Paddy3118 22:10, 10 August 2008 (UTC)

My mistake. I wrote that program; the problem was that I used the Haskell implementation GHC, which allowed the literal "10000" to be an Int, and Codepad uses Hugs, which apparently interprets all literal integers as Integers by default. I believe the dreaded monomorphism restriction is to blame. Anyway, I added an explicit type signature, so the program now works with Hugs. Underscore 15:24, 11 August 2008 (UTC)
Thanks. I ran it on codepad and inserted some sample output. --Paddy3118 15:59, 11 August 2008 (UTC)

ADA program problem

The probabilities should tend to 1/3 for sticking with your original guess whereas your result seems to be 1/2 making me think you could have a problem in the Ada program. --Paddy3118 15:09, 11 August 2008 (UTC)

The number of iterations was simply not enough to get a stable random number generator on a fast machine. I have increased the number of iterations and achieved the expected results.--Waldorf 00:18, 15 August 2008 (UTC)

Probability error

Several sample outputs are suggesting that the total probability does not equal 100% which can't be right. --Lupus 11:38, 5 November 2008 (UTC)