Post Reply 
(71B) Buffon's Needle
09-08-2019, 09:54 PM
Post: #2
RE: (71B) Buffon's Needle
(09-08-2019 04:00 PM)SlideRule Wrote:  30 H=0 @ FOR J=1 TO 10 @ IF RND()<SIN(RND()*PI) THEN H=H+1
40 NEXT J @ R(H)=R(H)+1 @ P=P+H

You will get a syntax error entering line 30, it's just RND, without the parentheses, not RND().

Also, it should run somewhat faster if you include the NEXT J also in line 30, like this:

30 H=0 @ FOR J=1 TO 10 @ H=H+(RND<SIN(RND*PI)) @ NEXT J

(written and posted on the go using a tablet, still not at my laptop)

Regards.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(71B) Buffon's Needle - SlideRule - 09-08-2019, 04:00 PM
RE: (71B) Buffon's Needle - Valentin Albillo - 09-08-2019 09:54 PM
RE: (71B) Buffon's Needle - J-F Garnier - 09-09-2019, 07:20 AM



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