引用igg · 2020-08
“Digging deeper, at least one of the PRs [1] is based on a 2018 paper [2].”
指出其中一个 PR 基于这篇 2018 年的论文
无偏随机整数的区间映射:高概率避开整数除法,洗牌更快
论文回顾一种在区间 [0,s) 内生成无偏随机整数的算法:它从随机字出发,高概率避免整数除法,而标准库(如 Java)的常见做法依赖开销较大的除法。作者证明该方法在 x64 上可成倍加快无偏随机洗牌,并已被 Go 语言用于其 shuffle 实现。
评论者追溯某些语言(如 Julia)更快随机整数实现的来源时引用它,并澄清它不是随机数生成器本身,而是把随机数输出无偏地映射到任意区间的方法。
“Digging deeper, at least one of the PRs [1] is based on a 2018 paper [2].”
“I did skim the paper to find which of the listed algorithms is the one in question (Algorithm 5)”
“Looking at the original paper this doesn't seem to be a RNG itself but rather a method to efficiently transform the output of a RNG onto an arbitrary interval while maintaining a uniform distribution.”
“wrote blog posts and an academic paper comparing different approaches”