Skip to content

Conversation

@coffeexcoin
Copy link
Contributor

@coffeexcoin coffeexcoin commented Jul 28, 2025

  • feat: add LibAlias (implementation of AJ Walker Alias method) for random probability calculation
  • adjust pragma

PR-Codex overview

This PR introduces the LibAlias library for efficient weighted random sampling using the alias method. It includes functionality for constructing an alias table, selecting random indices, and handling probabilities and aliases.

Detailed summary

  • Added LibAlias library for weighted random sampling.
  • Implemented select function for O(1) sampling.
  • Added setRaw function to set alias table from preprocessed data.
  • Created fill function for constructing alias table from weights.
  • Introduced error handling for array length mismatches.
  • Developed tests in LibAliasTest for various sampling scenarios.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@coffeexcoin coffeexcoin merged commit 0d4138e into main Jul 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants