问题描述
我已经使用了LegacySQL rand()
函数(在此找到),然后以整数作为参数来植入随机数生成过程.
I have used the LegacySQL rand()
function (found here) before which takes an integer as an argument for seeding the random number generation process.
当我开始在StandardSQL中使用相同的 rand()
函数时(在此处找到),它不允许我提供种子.所以我的问题是生成数字时是否要播种,有没有办法在BigQuery的StandardSQL中做到这一点?
When I started using the same rand()
function in StandardSQL (found here), it does not allow me to provide a seed. So my question is if I want do some seeding when generating number, is there a way to do it in StandardSQL in BigQuery?
这很重要,因为在科学研究中有时我们需要处理随机数,但结果也需要可重现.
This is important because in scientific research sometimes we need to deal with random numbers but also the results need to be reproducible.
推荐答案
不幸的是,没有办法为 RAND()
函数.在此公共问题跟踪器中,您可以看到整数类型在 RAND()
函数.这些问题已在标准SQL中得到纠正,因此,一些内置函数被修改.
Unfortunately, there is no way to provide a seed into the RAND()
function in the standard SQL language. In this public issue tracker you can see that the integer types created a problematic scenario in the RAND()
function. These issues were corrected in standard SQL and, as a consequence, some built-in functions were modified.
这篇关于有没有办法在BigQuery Standard SQL中播种随机数生成过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!