/Find-Pi-by-random

Test from one interview

Primary LanguageGoMIT LicenseMIT

NAME

Find-Pi-by-random - Find Pi by random shots

SYNOPSIS

main [options]

DESCRIPTION

The number π is a mathematical constant, the ratio of a circle's circumference to its diameter, commonly approximated as 3.14159.

This program makes the "shots" in the square and finds hits in relation to all the inscribed circle "shots".

This program was test from interview to Прогрэдис, Russian IT company. One my friend sends this to me: You have foursquare and inscribed circle, you have to do random shots to the foursquare and find Pi.

OPTIONS

-r=INT

Set circle size

-shots=INT

Set shots count

SAMPLE OUTPUT

Radius   = 10000000
Shots    = 10000000
Pi       = 3.141492
Accuracy = 0.999968
Time     = 779.1206ms