benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 50224f72-b91b-5a64-9c70-e631459b717b

Problem

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

complete prompt

import numpy as np
import matplotlib.pyplot as plt

# Constants
ARRAY_SIZE = 10000

def task_func():
    """
    Create a numeric array of random integers, calculate the mean and standard deviation, and draw a histogram of the distribution.

    Returns:
    Tuple: A tuple containing the array, mean, standard deviation, and the histogram plot (Axes).

    Note:
        The random integers are generated between 1 and 100. The title of the histogram is "Histogram of Random Values". 
        The x-axis is labeled "Val" and the y-axis is labeled "Freq". 
        The mean is plotted as a red dashed line, and the standard deviation is plotted as purple dashed lines.
        
    Requirements:
    - numpy
    - matplotlib.pyplot
    
    Example:
    >>> import numpy as np
    >>> np.random.seed(0)
    >>> array, mean, std, ax = task_func()
    >>> print(mean, std)
    250.7154 142.85617453522966
    >>> plt.show()
    """

instruct prompt

Create a numeric array of random integers, calculate the mean and standard deviation, and draw a histogram of the distribution.
Note that: The random integers are generated between 1 and 100. The title of the histogram is "Histogram of Random Values". The x-axis is labeled "Val" and the y-axis is labeled "Freq". The mean is plotted as a red dashed line, and the standard deviation is plotted as purple dashed lines.
The function should output with:
    Tuple: A tuple containing the array, mean, standard deviation, and the histogram plot (Axes).
You should write self-contained code starting with:

Code

import numpy as np
import matplotlib.pyplot as plt
# Constants
ARRAY_SIZE = 10000
def task_func():

code prompt

Code

import numpy as np
import matplotlib.pyplot as plt
# Constants
ARRAY_SIZE = 10000
def task_func():

entry point

task_func

libs

  • numpy
  • 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