创建从有序列表中选择一个随机的有序列表 [英] Creating a random ordered list from an ordered list

查看:116
本文介绍了创建从有序列表中选择一个随机的有序列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于创建从有序列表中选择一个随机的有序列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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