创建从有序列表中选择一个随机的有序列表

创建从有序列表中选择一个随机的有序列表

问题描述:

我有一个应用程序,采用质量结果的制造工艺和 创建图形既显示不良的排列图,并且还显示生产吞吐量。

I have an application that takes the quality results for a manufacturing process and creates graphs both to show Pareto charts of the bad, and also to show production throughput.

要实现自动化测试这些统计程序,我想确定性能够添加记录到数据库中,并有质量技术去特定的图表和比较已知良好的图形的任务。但是,我也想模仿的结果,这样他们就进入数据库,如果用户是通过测试过程中运行。

To automate the task of testing these statistical procedures I would like to deterministically be able to add records into the database and have the quality tech go to certain graphs and compare to a known good graph. But, I also would like to simulate the results so they would go into the database as if a user was running through the testing process.

一个想法我已经是填充列表与我一批善,J号bad1,K个坏2,等等。然后以某种方式随机插入排序前列表到数据库。

One idea I have had is to fill a list with i number good, j number bad1, k number bad 2, etc. And then somehow randomly sort the list before insertion into the database.

所以,我的问题,是有一个标准的算法,取​​值排序列表,并创建一个随机排序列表?

So, my question, is there a standard algorithm to take a sorted list of values and create a randomly sorted list?

您将要使用的洗牌算法。确保使用正确的洗牌算法,而不是自制的,因为它可能会推出某种形式的微妙格局中的数据。请参见这个职位由杰夫·阿特伍德这个问题,使用足够随机的洗牌。

You'll want to use a shuffle algorithm. Make sure to use a proper shuffle algorithm and not a home-baked one, because it may introduce some form of subtle pattern to the data. See this post by Jeff Atwood about the problem with using "random enough" shuffles.