我如何在范围内生成所有可能的整数
我一直在寻找通过种子大量生成的一段时间,由于它的特定程度,我一直在努力寻找我想要的东西。例如输入过程。另一个问题是我希望能够扭转该过程,以了解我如何到达那里。如果我有这个数字,我想知道什么输入或种子会产生什么。希望这是有道理的,我理解这是一个非常具体的问题。
I have been looking for a while at large number generation through seeds and I’ve struggled to find what I am looking for due to how specific it is. I think the main thing that is causing the problems is the size of numbers I want to generate, for example... I want to have it so that I can generate every single number that is 5000 digits long through some form of seed or selective input process. The other problem being that I would like to be able to reverse the process to know how I got there. If I have this number I want to know what inputs or what seed would generate this. Hope this makes sense and I understand this is a extremely specific question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这样的问题,我将使用加密。由于加密是一个一对一的过程,只要您使用唯一的输入,并保留相同的键,则可以保证输出唯一。对于唯一的输入,请加密数字0、1、2、3,...您需要通过添加领先的零来扩展输入,以便它们是所需的尺寸,足以满足5,000个小数位数的二进制。
来自加密的输出的大小相同。只需将二进制输出转换回等效的小数号。在小数和二进制边界的情况下,可能有一些边界案例。在这种情况下,只需重新加入直到结果在设定限制之内。这是保存加密格式的循环步行技术。
For a problem like this I would use an encryption. Since encryption is a one-to-one process provided you use unique inputs, and keep the same key, then the outputs are guaranteed unique. for unique inputs, encrypt the numbers 0, 1, 2, 3, ... You will need to extend the inputs by adding leading zeros so they are the size you need, enough for the binary equivalent of 5,000 decimal digits.
The output from the encryption will be the same size. Just convert the binary output back into the equivalent decimal number. There may be a few boundary cases just over the limit where the decimal and binary boundaries; in those cases just re-encrypt until the result is within the set limit. This is the cycle walking technique from Format Preserving encryption.