{"id":23031038,"url":"https://github.com/timerke/montecarlopi","last_synced_at":"2025-04-02T21:24:02.167Z","repository":{"id":132613856,"uuid":"326651740","full_name":"timerke/MonteCarloPi","owner":"timerke","description":"Calculation of π number by the Monte Carlo method. Multithreading is used","archived":false,"fork":false,"pushed_at":"2021-01-04T16:53:02.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T11:43:07.354Z","etag":null,"topics":["cpp","monte-carlo"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timerke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-04T10:45:40.000Z","updated_at":"2021-01-28T19:49:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"7339a53e-b821-4b6e-aa57-6f286e71ed2c","html_url":"https://github.com/timerke/MonteCarloPi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timerke%2FMonteCarloPi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timerke%2FMonteCarloPi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timerke%2FMonteCarloPi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timerke%2FMonteCarloPi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timerke","download_url":"https://codeload.github.com/timerke/MonteCarloPi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246894126,"owners_count":20851064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","monte-carlo"],"created_at":"2024-12-15T15:32:39.832Z","updated_at":"2025-04-02T21:24:02.149Z","avatar_url":"https://github.com/timerke.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MonteCarloPi\n[![Build Status](https://travis-ci.com/timerke/MonteCarloPi.svg?branch=main)](https://travis-ci.com/timerke/MonteCarloPi)\n\nCalculation of `π` number by the Monte Carlo method. Multithreading is used\n\n## Task\nWrite a program for the approximate calculation of the `π` number by the Monte Carlo method.\n\nTo do this, generate `M` pairs of random numbers in the range `[0, D]`. Use them like coordinates of points on the plane. Count how many points `N` fall into the circle inscribed in a square with side `D` (a circle centered in coordinates `(D/2, D/2)` and diameter `D`). The ratio of the areas of a circle and a square will tend to the ratio the number of points in the circle to the total number of points. The area of a circle is `S1 = πD^2/4`, the area of a square is `S2 = D^2`. So we can estimate the value of `π` as: `N/M = S1/S2 = π/4 -\u003e π = 4N/M`.\n\nDemonstrate results for different values of `M` and `D`. Use multithreaded implementation for different numbers of parallel threads.\n\n## Задание\nНаписать программу для приближенного вычисления числа `π` методом Монте-Карло.\n\nДля этого сгенерировать `M` пар случайных чисел в диапазоне `[0, D]`. Используя их как координаты точек на плоскости, посчитать сколько точек `N`, которые попадают в круг,\nвписанный в квадрат со стороной `D` (круг с центром в координатах `(D/2, D/2)` и диаметром `D`). Отношение площадей круга и квадрата будет стремиться к отношению количества точек, попавших в круг, к общему количеству точек. Согласно формуле для площади круга `S1 = πD^2/4`, можно оценить значение `π` как `4N/M`.\n\nПродемонстрировать результаты для разных значений `M` и `D`. При многопоточной реализации дополнительный параметр `T` — количество параллельных потоков. При выводе результата также указывать время вычислений. Показать значения времени для разного количества потоков.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimerke%2Fmontecarlopi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimerke%2Fmontecarlopi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimerke%2Fmontecarlopi/lists"}