我试图使用mt19937在静脉上为我的节点/车辆类生成(好的)随机数。当我对每辆车使用一个mt19937时,他会工作,但当我设置为静态的(对所有汽车都使用一个mt19937 )时,他就不工作了。
static mt19937 mt;使用mt时发生一个错误:
uniform_int_distribution <int> unif_dist(1, 100);
...
return unif_dist(mt);错误:
在网络设置过程中模块(cModule) vehDist_rsu (id=48)中的错误:未找到类"Veins::ObstacleControl“--也许它的代码没有链接到,或者类没有在Register_Class()中注册,或者在模块和通道的情况下,用Define_Module()/Define_Channel()注册。 网络清理过程中的错误:模型错误:断言:函数deleteNetwork中的条件csimulation.cc false,csimulation.cc第437行。
发布于 2016-10-12 19:03:32
我将我的静脉更新为静脉4.4,在BaseWaveApplLayer.h中将mt19937设置为静态的:
static mt19937 mt;在我的汽车类中定义他:
mt19937 BaseWaveApplLayer::mt_veh;并在BaseWaveApplLayer类中使用他:
uniform_int_distribution <int> dist(0, 100);
int valueSelected = dist(mt_veh);感谢大家的帮助:)!
https://stackoverflow.com/questions/36915543
复制相似问题