Seeding in MATLAB with rng with parfor
假设我在matlab中有以下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
上面每个循环中的第三行捕获了我应用于
如何使用
我不经常使用
1 2 3 4 5 6 7 8 9 10 |
注意每个工人如何以相同的顺序生成相同的随机数。(迭代被随机分配给工人,并以随机顺序运行;这是通过设计实现的)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers. Worker 11688, iteration 1, random number 0.275141 Worker 17188, iteration 2, random number 0.275141 Worker 18408, iteration 4, random number 0.275141 Worker 18408, iteration 3, random number 0.423046 Worker 5812, iteration 6, random number 0.275141 Worker 5812, iteration 5, random number 0.423046 Worker 11688, iteration 8, random number 0.423046 Worker 11688, iteration 7, random number 0.973406 Worker 17188, iteration 9, random number 0.423046 Worker 18408, iteration 10, random number 0.973406 Worker 5812, iteration 11, random number 0.973406 Worker 17188, iteration 12, random number 0.973406 |
号