Post Reply 
An unexpected result involving sums of random numbers
03-04-2023, 05:47 PM (This post was last modified: 03-04-2023 05:48 PM by Gil.)
Post: #22
RE: An unexpected result involving sums of random numbers
Thanks, obrigado.

Minha última versão, com UNTIL
« TIME 1. RDZ 0. 0.
1. 100000.
START
WHILE DUP 1. <=
REPEAT RAND +
SWAP 1. + SWAP
END DROP 0.
NEXT DROP
1000000. / TIME ROT
HMS-
»

... antes de descobrir a sua, Gérson, bem mais eficiente — que nunca conta, na soma das tentativas, o primeiro número aleatório, que você só acrescenta no final das contas.

Nice too how you used 0 0 and changed one of the two zeroes to 1 for the loop from 1 to 100 000. The DUP2 was nice to get the 0 and keep track, in one step, of the initial 100000 for the final average (division).
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 - Gil - 03-04-2023 05:47 PM



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