PRNG 需要线程安全吗? [英] Do PRNG need to be thread safe?

查看:93
本文介绍了PRNG 需要线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要并发调用不会导致 seg-v 或返回相同的值,在 PRNGs 当这些错误的主要影响是不可预测的结果时,这就是 PRNG 的意义所在?

As long as concurrent calls don't cause seg-v's or return the same value, what reasons are there for preventing race conditions and data corruption in PRNGs when those error's primary effects are unpredictable results and that is the point of a PRNG?

是否有任何 PRNG 不会在竞争条件和数据损坏的情况下受到影响?

are there any PRNG that wouldn't suffer under race conditions and data corruption?

推荐答案

PRNG 是精心构建的工具——坦率地说,如果竞争条件和线程错误是一个好的 PRNG,那么实现就会这样编写.

PRNGs are meticulously constructed tools -- frankly, if race conditions and threading bugs were a good PRNG, the implementation would be written that way.

添加线程错误以增加随机性的问题在于,这是对生成器的未经研究的更改.现有的安全算法和实现已经过详尽的测试;如果你想尝试一个不安全的变体,你需要做一些统计工作来证明它至少和普通 PRNG 一样随机.

The problem with adding threading bugs to increase randomness is that it's an unstudied change to the generator. Existing secure algorithms and implementations have been exhaustively tested; if you want to try an unsafe variant, you'll need to do the statistical grunt work to show that it's at least as random as a normal PRNG.

这篇关于PRNG 需要线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆