生成一些随机数据构成的 xls

【问题】

I want to make a series of tables that each contain 25 values, that come from a set of 30 values. How can I quickly, and randomly, produce these tables? I'm wondering if there is a way in excel, or will I need to program something, myself? If so, which language would be the easiest (Python, C, Java)?

Edit: The 25 values would include no repeats. In other words, I'm looking for random combinations (30C25) of the values.

【回答】

随机填充库表,用Python,Perl的代码通常比较繁琐,这类数据库运算用集算器会相对简单。假设目标表为table1,只有一个字段field1,代码如下:

A
1 =["value1","value2"…"value30"]
2 =A1.sort(rand()).to(1,25)
3 =mySQLdb.update@a(A2,table1,filed1:~)

A1:定义30个不重复数据,组成序列

A2:随机选出25个数据

A3:数据入库

如果样本数据是来自某表的30条记录,代码可以这样写:

A
1 $select field1 from table1
2 =A1.sort(rand()).to(1,25)
3 =mySQLdb.update@a(A2,table1)

A1:在数据源中执行sql查询语句,返回结果集。

多个表可以循环填充

A B
1 =["value1","value2"…"value30"] =["tableA","tableB","tableC"]
2 for B1 =A1.sort(rand()).to(1,25)
3 =eval("myDB1.update@a(B2,"+A2+",c1:~)")

参考【离线自由计算】

你可能感兴趣的:(JAVA计算,mysql,xls)