什么随机(INT种子)保证? [英] What does Random(int seed) guarantee?

查看:155
本文介绍了什么随机(INT种子)保证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个项目,它依赖用户分配随机的(没有什么花哨,只是均匀)的大集合的子集。每个用户具有从一组同构的整数的唯一标识符。有两种方法可以这样做,据我所看到的。

I'm working on a project, that relies assigning users random (nothing fancy, just uniformly) subsets of a larger set. Each user has a unique identifier from a set isomorphic to integers. There are two approaches to doing this, as far as I can see.

  1. 创建用户和前面提到的大集合键控元件之间的连接处的数据库表的一些功能,一次为每个用户。这对于我的需求有点不切实际,所以我宁愿做...
  2. 在运行时确定由类似功能的子集,但使用唯一的用户id作为种子值,而只是有一组在内存中。下一次,它需要它的再创造,从一个更大的集。

我的问题是,如果我使用.NET Random对象使用用户ID作为种子值创建第二个功能,微软是否保证不改变随机算法的未来?即将所有新的随机(N)的下一个()序列是一样的永远在所有机器

So my question is, if I use the .NET Random object to create the second function using user-id as a seed value, does Microsoft guarantee not to change the Random algorithm in the future? I.e. will all new Random(n)'s Next() sequences be the same forever on all machines?

另外,我可以创建自己的随机数发生器,它与我的code包。其实,这就是我可能会做,但我仍然很想知道答案。

Alternatively I could create my own random generator, and package it with my code. In fact, this is what I'll probably do, but I'm still curious to know the answer.

推荐答案

微软的不能向你保证,他们的code永远不会改变为code改进发生在确定的漏洞,问题或商品缺,但到目前为止,code并没有改变,如果你不更改,课程框架,你应该始终具有相同的功能。

Microsoft cannot guarantee you that their code will never change as code improvement happens on identified vulnerabilities, issues or commodities-lack but, so far, the code hasn't changed and if you do not change frameworks on-course you should always have the same functionality.

所以,把它仿佛它不会改变......但是当你决定要升级架构,确保它仍然有效一样。

So take it as if it won't change... but when you decide to upgrade your framework, make sure it still works the same.

这篇关于什么随机(INT种子)保证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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