Port Math::Random::MT as a bundled Java XS implementation
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start by inspecting the bundled Java XS bridge pattern and registry, then read the upstream Math-Random-MT 1.17 tests and implementation to identify the required seeded vectors and API behavior. Add the bridge, Perl shim, and focused project tests; validate those tests with system Perl first. Done means the upstream suite and both named Games-Solitaire-BlackHole-Solver tests pass on JVM and interpreter backends, with no runtime need for MT.xs or _mt.c.
由索引模型根據 Issue 內容生成。
描述
Summary
Add a bundled Java implementation of Math::Random::MT so PerlOnJava can load the CPAN module without its XS binary. This should also unblock CPAN consumers that require Math::Random::MT at runtime, including Games-Solitaire-BlackHole-Solver.
Evidence
CPAN random run 20261109-091152-39587 tested Games-Solitaire-BlackHole-Solver 0.18.0. Under PerlOnJava, t/00-compile.t could not load Math::Random::MT because no Java XS implementation was available; t/01-run.t then failed after the solver could not run. The system-Perl oracle passed the complete target suite: 27/27 tests across both test programs. The same system-Perl run built and passed Math-Random-MT 1.17's nine test files (125 tests).
The failed solver requires Math::Random::MT at runtime. Targeted MetaCPAN reverse-dependency data reports 13 unique released CPAN distributions with runtime dependencies, 4 recent; examples include Games-Solitaire-BlackHole-Solver, Task-BeLike-SHLOMIF, Log-GELF-Util, and Bencher-Scenario-RandomNumbers.
Proposed implementation
Provide the Java XS bridge and Perl shim for the Math::Random::MT API, following the project's existing Java XS bridge pattern. Bouncy Castle is already a project dependency, but its documented RandomGenerator is an interface and does not itself provide an MT19937 engine. Avoid assuming that a Bouncy Castle DRBG has MT19937-compatible sequences. A small pure-Java MT19937 implementation avoids adding another runtime dependency; Apache Commons RNG is an alternative only if its additional dependency and seed/output compatibility are justified.
Preserve the CPAN module's behavior and seeded sequence, including:
- Object interface:
new,set_seed,get_seed,rand, andirand. - Functional interface and optional exports:
srand,rand, andirand. - Single unsigned 32-bit seed and array seeding (up to 624 words), including the published high-value seed cases.
- Automatic seeding when no seed is supplied, without changing Perl's
CORE::randstate beyond the upstream behavior. - Unsigned 32-bit results from
irandand[0, n)floating-point results fromrand(n).
Acceptance criteria
- Add the module to the bundled Java XS registry and provide the required Perl-facing shim, without modifying upstream CPAN tests.
- Add project-owned focused tests for seeded MT19937 output, array seeding, unsigned output, OO calls, function imports, and automatic seeding. Validate new Perl unit tests with system Perl first as required by the repository.
- Run the upstream
Math-Random-MT1.17 suite with the Java implementation and confirm its deterministic vectors match system Perl. - Re-run
Games-Solitaire-BlackHole-Solver0.18.0 with PerlOnJava and confirm botht/00-compile.tandt/01-run.tpass; test JVM and interpreter backends. - Confirm native
MT.xs/_mt.cis not needed at runtime when the Java implementation is selected.
References
- CPAN distribution: https://metacpan.org/release/FANGLY/Math-Random-MT-1.17
- Bouncy Castle
RandomGeneratorAPI: https://downloads.bouncycastle.org/java/docs/bcprov-jdk18on-javadoc/org/bouncycastle/crypto/prng/RandomGenerator.html - Apache Commons RNG MT19937 API (candidate if a dependency is preferred): https://commons.apache.org/proper/commons-rng/commons-rng-docs/apidocs/org/apache/commons/rng/core/source32/MersenneTwister.html
- 主要語言
- Perl
- 星號
- 67
- 分支
- 8
- 平均合併
- 5 小時 12 分鐘
- 30 天內合併 PR
- 131
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port bug
難度 2/5 1-3 小時 新手友好度 70/100
fglock/PerlOnJava#2153 ·
維護者通常 1 天內回覆
-
area:cpan-port area:parser bug
難度 2/5 1-3 小時 新手友好度 68/100
fglock/PerlOnJava#2137 ·
維護者通常 1 天內回覆
-
area:backend area:cpan-port area:runtime bug
難度 2/5 1-3 小時 新手友好度 76/100
fglock/PerlOnJava#2071 ·
維護者通常 1 天內回覆
-
area:runtime documentation enhancement
難度 2/5 1-3 小時 新手友好度 72/100
fglock/PerlOnJava#1579 ·
維護者通常 1 天內回覆
-
area:cpan-port bug
難度 3/5 1-2 天 新手友好度 62/100
fglock/PerlOnJava#2157 ·
維護者通常 1 天內回覆
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling links未關閉team-cli
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
-
難度 1/5 1 小時以內 新手友好度 93/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 73/100
inverse-inc/packetfence#9728 ·
維護者通常 1 天內回覆
-
fix(char-create): show the real reason a character is refused可能已有人在做 @baphomello 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆