HF RL Explorer

Weighted Random Sampling Without Replacement

Weighted Random Sampling Without Replacement: a task in Terminal-Lego-15k (Harbor dataset). Implement a program that selects k random elements from a list of items where each item has an associated weight. The selection should be done without replacement (each item can only be selected once), and…

The task

Implement a program that selects **k random elements** from a list of items where each item has an associated weight. The selection should be done **without replacement** (each item can only be selected once), and the probability of selecting each item should be proportional to its weight.

Part of PrimeIntellect/Terminal-Lego-15k.