benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e83da009-e54c-58fd-bf0d-663eb5e11b01

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import math
import random
import statistics

# Constants
RADIUS = 5

def task_func(n):
    """
    Generate n random points within a circle of radius RADIUS (default value is 5) and return their average distance from the center.

    Parameters:
    - n (int): The number of points to be generated.

    Returns:
    - float: The average distance from the center of the circle.

    Requirements:
    - math
    - random
    - statistics

    Example:
    >>> random.seed(42)
    >>> task_func(100)
    3.2406
    >>> task_func(50)
    3.4443
    """

instruct prompt

Generate n random points within a circle of radius RADIUS (default value is 5) and return their average distance from the center.
The function should output with:
    float: The average distance from the center of the circle.
You should write self-contained code starting with:

Code

import math
import random
import statistics
# Constants
RADIUS = 5
def task_func(n):

code prompt

Code

import math
import random
import statistics
# Constants
RADIUS = 5
def task_func(n):

entry point

task_func

libs

  • statistics
  • math
  • random

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import