benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1791f8d3-bbef-5b21-8ba9-78298635ad54

Problem

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

complete prompt

import random
import math
import matplotlib.pyplot as plt

def task_func(points_count=1000, radius=1):
    """
    Generate a specified (i.e., points_counts) number of random points within a circle of a given radius and plot them using a scatter plot.

    Parameters:
    - points_count (int): The number of random points to generate. Default is 1000.
    - radius (float): The radius of the circle within which points are generated. Default is 1.

    Returns:
    - Axes: The matplotlib Axes object representing the scatter plot.

    Note:
    - All settings of the scatter plot are the default version.
    - The aspect ratio of the plot is set to 'equal' to maintain proportions.

    Requirements:
    - random
    - math
    - matplotlib.pyplot

    Example:
    >>> import matplotlib.pyplot as plt
    >>> random.seed(0)
    >>> ax = task_func(500, 0.5)
    >>> len(ax.collections[0].get_offsets())
    500
    >>> plt.close()
    """

instruct prompt

Generate a specified (i.e., points_counts) number of random points within a circle of a given radius and plot them using a scatter plot.
Note that: All settings of the scatter plot are the default version. The aspect ratio of the plot is set to 'equal' to maintain proportions.
The function should output with:
    Axes: The matplotlib Axes object representing the scatter plot.
You should write self-contained code starting with:

Code

import random
import math
import matplotlib.pyplot as plt
def task_func(points_count=1000, radius=1):

code prompt

Code

import random
import math
import matplotlib.pyplot as plt
def task_func(points_count=1000, radius=1):

entry point

task_func

libs

  • math
  • random
  • matplotlib

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