可逆随机发生器? [英] Reversible random generator ?

查看:61
本文介绍了可逆随机发生器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我想知道是否有一个可逆的随机发生器。我需要在我的应用程序中及时返回
,并且仍然需要使用

确定性随机数。 RNG的大部分实现了Next函数

但是上一个怎么样?

我知道我可以使用数组来存储X的最后值但我是更多

有兴趣知道它是否存在允许倒退的东西。

此外,我真的不能使用相同的种子和循环直到我得到

之前的值。


谢谢!

解决方案

ki******@gmail.com 说:


大家好,


我想知道是否有一个可逆的随机发生器。我需要在我的应用程序中及时返回
,并且仍然需要使用

确定性随机数。 RNG的大多数实现了Next函数

但是上一个是什么?



大多数PRNG都是有损的(就可逆性而言),依靠模数

操作来跳转数字空间。但是为什么你不能只将每个生成的数字推到堆栈上?然后,只要你需要及时回归,你就可以弹出并重新播种




-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日


10月9日凌晨1点49分,kitti ... @ gmail.com写道:


大家好,


我想知道是否有一个可逆的随机发生器。我需要在我的应用程序中及时返回
,并且仍然需要使用

确定性随机数。 RNG的大部分实现了Next函数

但是上一个怎么样?

我知道我可以使用数组来存储X的最后值但我是更多

有兴趣知道它是否存在允许倒退的东西。

此外,我真的不能使用相同的种子和循环直到我得到

之前的值。



这对于clc来说真的是OT,有点像comp.programming会更好,而且sci.crypt会很好,除了那个sci.scrypt在过去的几个月里已经完全是DOS了。


无论如何,这并不难,但是你做了需要决定你有多好,你想要伪造的随机数是多少。基本上使用一个计数器,然后

然后将它转换成一个随机数,并适当增加或

根据你的next_rand或prev_rand递减计数器

功能。如果您使用AES作为转换,那么在基本理解的CTR(计数器)模式下使用AES基本上就是
,并且您将获得
产生相当不错的随机数字。如果你想要一些相当简单(和更快)的东西,可以使用随机的东西。

的数量相当低质量,你可以做点反转的事情

计数器然后mod 32767它。


10月9日下午4:20,Richard Heathfield< r ... @ see.sig.invalidwrote:
< blockquote class =post_quotes>
kitti ... @ gmail.com说:


大家好,


我想知道是否有一个可逆的随机生成器。我需要在我的应用程序中及时返回
,并且仍然需要使用

确定性随机数。 RNG的大多数实现了Next函数

但是上一个是什么?



大多数PRNG都是有损的(就可逆性而言),依靠模数

操作来跳转数字空间。但是为什么你不能只将每个生成的数字推到堆栈上?然后,只要你需要及时回归,你就可以弹出并重新播种




-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日



问题是如果让我说我必须在

秒产生1000随机并需要存储100分钟随机,它不会真的是对记忆有益的。


Hi all,

I was wondering if there is a random generator that is "reversible". I
need to go back in time in my application and still need to use
deterministic random numbers. Most of RNG implement the Next function
but what about a Prev ?

I know I can use an array to store X last values but I''m more
interested to know if it exist something that allows to go backwards.
Also I can''t really afford to use the same seed and loop until i get
the previous value.

Thank you !

解决方案

ki******@gmail.com said:

Hi all,

I was wondering if there is a random generator that is "reversible". I
need to go back in time in my application and still need to use
deterministic random numbers. Most of RNG implement the Next function
but what about a Prev ?

Most PRNGs are lossy (in terms of reversibility), relying on a modulo
operation to jump around the number space. But why can''t you just push
each generated number onto a stack? Then you can just pop and re-seed
whenever you need to go "back in time".

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


On Oct 9, 1:49 am, kitti...@gmail.com wrote:

Hi all,

I was wondering if there is a random generator that is "reversible". I
need to go back in time in my application and still need to use
deterministic random numbers. Most of RNG implement the Next function
but what about a Prev ?

I know I can use an array to store X last values but I''m more
interested to know if it exist something that allows to go backwards.
Also I can''t really afford to use the same seed and loop until i get
the previous value.


This is really OT for c.l.c, someplace like comp.programming would be
better, and sci.crypt would be excellent, except that sci.scrypt has
been totally DOS''d for the past few months.

Anyway, it''s not hard to do, but you do need to decide on how good you
want the psuedo random numbers to be. Basically use a counter, and
then transform it into a random number, and appropriate increment or
decrement the counter as appropriate for your next_rand or prev_rand
function. If you use AES as your transform, you''ll essentially be
using AES in the well understood CTR ("counter") mode, and you''ll
produce pretty darn good "random" numbers. If you want something
rather simpler (and faster), but can live with "random" numbers of
considerably lesser quality, you could do something like bit reversing
the counter and then "mod 32767" it.


On Oct 9, 4:20 pm, Richard Heathfield <r...@see.sig.invalidwrote:

kitti...@gmail.com said:

Hi all,

I was wondering if there is a random generator that is "reversible". I
need to go back in time in my application and still need to use
deterministic random numbers. Most of RNG implement the Next function
but what about a Prev ?


Most PRNGs are lossy (in terms of reversibility), relying on a modulo
operation to jump around the number space. But why can''t you just push
each generated number onto a stack? Then you can just pop and re-seed
whenever you need to go "back in time".

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

The problem is that if let''s say I have to generate 1000 random in a
sec and need to store 100 min of random, it''s not really going to be
good for memory.


这篇关于可逆随机发生器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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