Round #886
11 May 2026, 09:58· csharp· Meta-Llama-3.3-70B-Instruct· r15-firing-v3
- Complexity
- band 0
- ZP / UO / OBS
- 0 / 0 / 0
- Journey weight
- 0
- Lightshift ΔL
- —
Prompt
Use Random.Shared to pick a random element from a List<T> in a generic Pick<T>(List<T>) extension method.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0018 | 2026-05-11T09:58:49Z
Use Random.Shared to pick a random element from a List<T> in a generic Pick<T>(List<T>) extension method.
ZERO POINT — 0 entries (structural invariants)
UNOBSERVED — 0 entries (implied truths)
OBSERVED — 0 entries (explicit in request)
COMPLEXITY │ 0 entries │ spread: 0° │ band: LOW
Baseline response (no ZPI)
### Random Element Picker Extension Method
Below is a simple implementation of a generic extension method `Pick` that uses `Random.Shared` to select a random element from a `List<T>`.
```csharp
using System;
using System.Collections.Generic;
public static class ListExtensions
{
/// <summary>
/// Picks a random element from the list.
/// </summary>
/// <typeparam name="T">Type of elements in the list.</typeparam>
/// <param name="list">The list to pick an element from.</param>
/// <returns>A random element from the list, or default(T) if the list is empty.</returns>
public static T Pick<T>(this List<T> list)
{
if (list == null)
{
throw new ArgumentNullException(nameof(list));
}
if (list.Count == 0)
{
return default(T);
}
int index = Random.Shared.Next(list.Count);
return list[index];
}
}
```
### Example Usage
Here's how you can use the `Pick` extension method:
```csharp
public class Program
{
public static void Main()
{
List<string> colors = new List<string> { "Red", "Green", "Blue", "Yellow" };
string randomColor = colors.Pick();
Console.WriteLine($"Random color: {randomColor}");
List<int> numbers = new List<int> { 1, 2, 3, 4, 5 };
int randomNumber = numbers.Pick();
Console.WriteLine($"Random number: {randomNumber}");
List<string> emptyList = new List<string>();
string randomElementFromEmptyList = emptyList.Pick();
Console.WriteLine($"Random element from empty list: {randomElementFromEmptyList}");
}
}
```
This code defines a `Pick` extension method that can be used on any `List<T>`. It uses `Random.Shared` to generate a random index into the list and returns the element at that index. If the list is empty, it returns the default value for the type `T`. The example usage demonstrates how to use this method with lists of different types.
Enhanced response (with ZPI)
```csharp
using System;
using System.Collections.Generic;
public static class ListExtensions
{
public static T Pick<T>(this List<T> list)
{
if (list == null)
{
throw new ArgumentNullException(nameof(list));
}
if (list.Count == 0)
{
throw new InvalidOperationException("List is empty");
}
return list[Random.Shared.Next(list.Count)];
}
}
```
This extension method uses `Random.Shared` to generate a random index into the list, and then returns the element at that index. It includes error checking to handle null lists and empty lists.
Grader chain
Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.
V1samba/Meta-Llama-3.3-70B-Instruct
BetterV4qwen2.5-coder-3b-instruct
BetterV5cerebras/qwen-3-235b-a22b-instruct-2507
BetterV7qwen2.5-coder-7b-instruct
BetterV8openai/gpt-4.1
SameV9anthropic/claude-opus-4-7
WorseV12openai/gpt-4o
BetterComments
Our grader said what it said. What do you say? Comment as a guest below.
No comments yet. Be the first to say what you make of this round.