arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.05099stat.APcs.MS
收藏

Randompack:跨平台可重复的随机数生成与分布采样

Randompack: Cross-Platform Reproducible Random Number Generation and Distribution Sampling

University of Iceland(冰岛大学)

Kristján Jónasson

AI总结:

Randompack是一个C库,提供多种随机数生成器和连续分布采样,支持跨平台可重复性,并具备高效的并行模拟支持。

摘要:

本文介绍了一个C库Randompack,实现了多种现代随机数生成器(如xoshiro256、PCG64、Philox等)和14种连续分布(如均匀、正态、指数、伽马、贝塔及多变量正态分布),支持原始位流、有界整数、排列和无重复采样。引擎与分布层分离,允许任意引擎与分布组合。基准测试显示,Randompack在不同引擎、分布、接口和平台上的速度提升范围为1至15倍。其独特之处在于可重复性:相同种子下,结果在不同编程语言、计算机、CPU架构和编译器间一致。库提供全面的并行模拟支持,包含详尽的测试套件、基准程序和示例程序。已实现Fortran、Python、Julia和R的接口,尽管其设计和实现不在本文范围内。与其他同类C库不同,Randompack采用MIT许可证,是开源且通过GitHub和conda-forge公开发布的。

英文摘要:

A C library for random number generation, Randompack, is presented. The library implements several modern random number generators (engines), including xoshiro256, PCG64, Philox, ranlux++, and sfc64; 14 continuous distributions including uniform, normal, exponential, gamma, beta, and multivariate normal; raw bit streams, bounded integers, permutations, and sampling without replacement. The engine and the distribution layers are separated so any engine can be used with any distribution. Benchmarks show that Randompack is faster overall than competing libraries, with speedup factors ranging from about 1 to 15 depending on engine, distribution, interface, and platform. A distinguishing feature is reproducibility: with the same seeds Randompack gives compatible results across programming languages, computers, CPU architectures, and compilers. The library includes comprehensive support for parallel simulation. It is accompanied by a comprehensive test suite, benchmarking programs, and example programs. Interfaces to Fortran, Python, Julia, and R have been implemented; their benchmark results are included, although their design and implementation are otherwise outside the scope of the article. Unlike other available C libraries with comparable scope, Randompack is permissively licensed under the MIT license, and it is open source and publicly available through GitHub and conda-forge.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑