<commit_before>import random
import math

randomize()

proc in_circle(x,y,radius: float): bool =
    return x * x + y * y < radius * radius

proc monte_carlo(samples: int): float =
    const radius: float = 1
    var count: int = 0

    for i in 0 .. < samples:
        var
            x: float = random(radius)
            y: float = random(radius)
        
        if in_circle(x,y,radius):
            count += 1
    
    var pi_estimate: float = 4 * count / samples
    return pi_estimate

let estimate: float = monte_carlo(1000000)

echo "the estimate of pi is ", estimate
echo "percent error: ", 100 * (abs(estimate - PI)/PI)<commit_msg>fixed formatting issues in nim implementation of montecarlo (#488)<commit_after>import random
import math

randomize()

proc in_circle(x, y, radius: float): bool =
  return x * x + y * y < radius * radius

proc monte_carlo(samples: int): float =
  const radius: float = 1
  var count: int = 0

  for i in 0 .. < samples:
    let
      x: float = random(radius)
      y: float = random(radius)
        
    if in_circle(x, y, radius):
      count += 1
    
  let pi_estimate: float = 4 * count / samples
  return pi_estimate

let estimate: float = monte_carlo(1000000)

echo "the estimate of pi is ", estimate
echo "percent error: ", 100 * (abs(estimate - PI)/PI)
{'fraction_non_alphanumeric': 0.1049808429118774, 'fraction_numerical': 0.02528735632183908, 'mean_word_length': 2.6582633053221287, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '253576', 'n_tokens_mistral': 453, 'n_tokens_neox': 417, 'n_words': 149}