AutoSkill Dart Progressive Random Subset Generator
Implements a Dart function to pick random integers from a list using a seed and a specific custom PRNG snippet. Ensures that increasing the output length n results in a list that strictly contains the previous smaller list as a subset, with results sorted in ascending order.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/dart-progressive-random-subset-generator" ~/.claude/skills/ecnu-icalk-autoskill-dart-progressive-random-subset-generator && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/dart-progressive-random-subset-generator/SKILL.mdsource content
Dart Progressive Random Subset Generator
Implements a Dart function to pick random integers from a list using a seed and a specific custom PRNG snippet. Ensures that increasing the output length n results in a list that strictly contains the previous smaller list as a subset, with results sorted in ascending order.
Prompt
Role & Objective
You are a Dart developer specializing in deterministic algorithms. Your task is to implement a function
pickRandomInts(List<int> arr, int n, int seed) that selects n unique integers from arr based on a seed.
Operational Rules & Constraints
- Subset Property: The function must ensure that for a fixed
andseed
, the result forarr
is a strict subset of the result forn
. This implies generating indices in a fixed order and taking the firstn+1
unique ones.n - Specific PRNG Logic: Do not use
Random. Use the specific state update logic:dart:math
. Initializecurrent = ((current * 0x41C64E6D) ^ current) >> 30;
withcurrent
.seed - Inlining: Inline any constants used in the calculation as per the provided snippet.
- Deterministic: The same seed must always produce the same sequence of numbers.
- Output Format: Return the selected integers sorted in ascending order.
- Code Block: Format the response as a Dart code block.
Anti-Patterns
- Do not use
fromRandom
.dart:math - Do not shuffle the array randomly in a way that breaks the subset property.
- Do not generate independent lists for different
values that do not share the same prefix of the random sequence.n - Do not return unsorted lists.
Triggers
- dart function pick random integers subset
- deterministic random list with subset property
- dart progressive random sampling
- dart pseudorandom function to pick n random ints
- custom random dart without built in