Looking for PRNG that you can seed with any number bytes

I'm looking for a PRNG (pseudo randomness) that you initially seed with an arbitrary array of bytes. Heard of any? Hashing your arbitrary length seed (instead of using XOR as paxdiablo suggested) will ensure that collisions are extremely unlikely, ie equal to the probability of a hash collision, with something such as SHA1/2 this is a practical impossibility. You can then use your hashe

寻找PRNG,你可以用任何数字字节播种

我正在寻找一种PRNG(伪随机),您最初使用任意字节数组进行播种。 听说过吗? 散列任意长度的种子(而不是像建议的paxdiablo那样使用异或)将确保碰撞是极不可能的,即等于散列冲突的概率,与诸如SHA1 / 2之类的事情相比,这实际上是不可能的。 然后你可以使用你的散列种子作为一个体面的PRNG的输入,例如我最喜欢的Mersenne Twister。 UPDATE 此处提供的Mersenne Twister实现似乎已接受任意长度的键:http://code.ms

Using noise to generate marching cube terrain?

I've succesfully made a marching cubes class in C# XNA and am using Lib noise to generate 3d perlin noise, but when I tried to generate terrain using the values of the perlin noise as the densities for my marching cubes it generates a large chunk of marching cubes with seemingly random triangles inside of them. I separated the marching cube and gave it arbitrary 3d arrays of densities to run

使用噪音来生成行进立方体地形?

我已经成功地在C#XNA中制作了一个行军立方体类,并且使用Lib噪声来生成3d perlin噪声,但是当我尝试使用perlin噪声值作为行进立方体的密度生成地形时,它会生成大块在里面看似随机的三角形行进的立方体。 我分开了行军立方体,并给它任意密度的三维数组来贯穿,所以我可以确保一切正常,它看起来很好,我有地形生成代码生成正常的立方体,我有一个正常的看地形,但问题是每个立方体的角落从噪音中获得价值总是从负面转变为正面

compile a gnulib based project to MinGW

I am trying to cross-compile this project to MinGW. The project uses autotools as the build system, and depends on libcurl, CUnit, Jansson and some gnulib modules. I have all the dependancies compiled for x86_64-w64-mingw32 and installed under /home/user/mingw64 I run: $ gnulib-tool --update $ autoreconf -fi $ CURL_CFLAGS="-I/home/user/mingw64/usr/local/include" CURL_LIBS="-L/home/user/mi

编译一个基于gnulib的项目给MinGW

我正在尝试将此项目交叉编译到MinGW。 该项目使用自动工具作为构建系统,并依赖于libcurl,CUnit,Jansson和一些gnulib模块。 我拥有为x86_64-w64-mingw32编译的所有依赖项,并安装在/home/user/mingw64 我运行: $ gnulib-tool --update $ autoreconf -fi $ CURL_CFLAGS="-I/home/user/mingw64/usr/local/include" CURL_LIBS="-L/home/user/mingw64/usr/local/lib -lcurl" JANSSON_CFLAGS="-I/home/user/mingw64/usr/lo

Marching Cubes generating holes in mesh

I'm working on a Marching Cubes implementation in Unity. My code is based on Paul Bourke's code actually with a lot of modifications, but anyway i'm checking if a block at a position is null if it is than a debug texture will be placed on it. This is my MC script public class MarchingCubes { private World world; private Chunk chunk; private List<Vector3> vertices = new L

行进立方体在网格中生成孔

我正在研究Unity中的Marching Cubes实现。 我的代码实际上是基于Paul Bourke的代码进行了大量的修改,但无论如何,我将检查某个位置的块是否为null,如果它不是调试纹理将放置在该位置上。 这是我的MC脚本 public class MarchingCubes { private World world; private Chunk chunk; private List<Vector3> vertices = new List<Vector3> (); private List<Vector3> normals = new List<Vector3>

Divide a number by 5 without using division operator

Possible Duplicate: implement division with bit wise operator Divide a number by 3 without using *, /, +, -, % operators I came across this question in an interview. I want to know if there any possibly way to divide a number by 5 without using division operator and if any possible solution exists using bitwise operators only.I figured one out using repeated subtraction till zero approache

不使用除法运算符将数字除以5

可能重复: 用位智者来实现分工 不使用*,/,+, - ,%运算符将数字除以3 我在采访中遇到了这个问题。 我想知道是否有任何可能的方法可以将数字除以5而不使用除法运算符,以及是否存在仅使用位运算符的任何可能的解决方案。我通过使用重复减法直到零逼近来计算出一个。 数字可以被签名和未签名。 请在不使用+, - ,/,*和%的情况下提出任何建议。 我的第一个想法是乘以0.2(但我不知道如何使用从头开始使用按位运算

Finding holes in 2d point sets?

I have a set of 2d points . They are X,Y coordinates on a standard Cartesian grid system(in this case a UTM zone ). I need to find the holes in that point set preferably with some ability to set the sensitivity of the algorithm that finds these holes. Typically these point sets are very dense but some can be much less dense. What they are, if it helps any, are points at which the soil in the

在2D点集中寻找洞?

我有一套2d points 。 它们是标准笛卡尔网格系统上的X,Y coordinates (在这种情况下是UTM zone )。 我需要找到那个点的孔,最好能够设置发现这些孔的算法的灵敏度。 通常这些点集非常密集,但有些可能不那么密集。 它们是什么,如果有帮助的话,那些地方的土壤已经被取样为农业中的人们显然有用的各种性质。 有时在这些点样品中有巨大的岩石或沼泽的地方或充满小湖泊和池塘。 从点集他们希望我找到大致定义这些孔的凹

NHibernate Expression.Like Criteria on Two Fields

I have an Nhibernate object that has the properties Firstname and Surname, and I'd like to be able to query on both fields (Firstname + " " + Surname); eg If the search term is "John Doe", this will be matched when John and Doe are in seperate fields. How can I achieve that? Thanks! So I ended up going with: .Add(Restrictions.Like(Projections.SqlFunction("concat",

NHibernate Expression.Like标准在两个领域

我有一个Nhibernate对象,它具有属性Firstname和Surname,并且我希望能够在两个字段(Firstname +“”+ Surname)上查询; 例如,如果搜索项是“John Doe”,那么当John和Doe处于独立字段时,这将匹配。 我怎样才能做到这一点? 谢谢! 所以我最终与: .Add(Restrictions.Like(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("Firstname"), Projections.Constant(" "

What is the difference between an orm and ADO.net?

I am reading a book and it says : "if you will create your own data access layer by using ADO.NET for access into you database, you will be minimally affected whether the data schema exists or not. If however you are using an O/RM, your flexibility will be limited by the tool you use". What is the major difference between ADO.NET and any other ORM? ADO.NET provides consistent access

orm和ADO.net有什么区别?

我正在阅读一本书,它说:“如果您将通过使用ADO.NET创建自己的数据访问层来访问您的数据库,那么您的数据架构是否存在将受到最小影响。但是,如果您使用的是O / RM,您的灵活性将受到您使用的工具的限制“。 ADO.NET和其他ORM之间的主要区别是什么? ADO.NET提供对数据源(如SQL Server和XML)以及通过OLE DB和ODBC公开的数据源的一致访问。 数据共享使用者应用程序可以使用ADO.NET连接到这些数据源并检索,处理和更新它们包

Wrong date format C#, Oracle

I'm trying to get my date in the correct format(dd/mm/yyyy). At the moment its in this format: MM-DD-YYYY HH24:MI:SS When I change it to dd/mm/yyyy, it works in the database(Oracle). As soon as I run it in my app I get exception: IndexOutOfRange at : this.InfoList9.Add(dr["start_rcv_datetime"].ToString()); Please see my code below. public List<String> InfoList = new List<String&

错误日期格式C#,Oracle

我试图以正确的格式(日/月/年)获取我的日期。 目前它的格式如下:MM-DD-YYYY HH24:MI:SS当我将其更改为dd / mm / yyyy时,它可以在数据库(Oracle)中运行。 只要我在我的应用程序中运行它,我会得到异常:IndexOutOfRange at: this.InfoList9.Add(dr["start_rcv_datetime"].ToString()); 请参阅下面的代码。 public List<String> InfoList = new List<String>(); private void populatelblDate() { c

can you safely re

I am using TransactionScope in the following fashion using (var scope = new TransactionScope()) { using (var conn = SQLHelpers.GetSQLConnection()) { //commands here } scope.Complete(); } Sometimes I am getting an TransactionAbortedException when calling scope.Complete() as the transaction has already been rolled back and I have used the profiler to determine the issu

你可以安心吗?

我使用以下方式使用TransactionScope using (var scope = new TransactionScope()) { using (var conn = SQLHelpers.GetSQLConnection()) { //commands here } scope.Complete(); } 有时我在调用scope.Complete()时收到TransactionAbortedException ,因为事务已经回滚,并且我使用分析器来确定问题是死锁。 异常事务(进程ID 59)在另一进程的锁资源上死锁,并被选为死锁受害者。 重新运行交