benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf fcd3ef0b-fc37-5a0e-a7b9-fee24e05748d

Problem

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

complete prompt

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt

def task_func(mean, std_dev, n):
    """
    Generates a set of samples from a normal distribution with a specified mean and standard deviation.
    It also visualizes the generated samples by plotting their histogram and the probability density function.

    Parameters:
    mean (float): The mean (mu) of the normal distribution.
    std_dev (float): The standard deviation (sigma) of the distribution.
    n (int): The number of samples to generate.

    Returns:
    numpy.ndarray: An array of generated samples from the normal distribution.

    Requirements:
    - numpy
    - scipy.stats
    - matplotlib.pyplot

    Examples:
    Generate 1000 samples from a normal distribution with mean 0 and standard deviation 1.
    >>> len(task_func(0, 1, 1000))
    1000

    Generate 500 samples from a normal distribution with mean 5 and standard deviation 2.
    >>> len(task_func(5, 2, 500))
    500
    """

instruct prompt

Generates a set of samples from a normal distribution with a specified mean and standard deviation. It also visualizes the generated samples by plotting their histogram and the probability density function. Generate 500 samples from a normal distribution with mean 5 and standard deviation 2. >>> len(task_func(5, 2, 500)) 500
The function should output with:
    numpy.ndarray: An array of generated samples from the normal distribution.
You should write self-contained code starting with:

Code

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(mean, std_dev, n):

code prompt

Code

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(mean, std_dev, n):

entry point

task_func

libs

  • numpy
  • matplotlib
  • scipy

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