zoukankan      html  css  js  c++  java
  • How to make omnetpp.ini variable randomized

    How to make omnetpp.ini variable randomized

    In simple modal file test.ned, I defined a variable as 

    double delay;

    In file omnetpp.ini, I initialized the variable, using

    **.delay = uniform(0,1)

    In cpp file, I read the variable as

    double delay=par("delay");

    Unfortrunicately, the delay I read out are always the same value.

    After read the "help file", I modifies it's defination as:

    volatile double delay;

    And the problem was solved!

    The keyword volatile ask the CPU to read the variable everytime, So, It can get the randomized value among each reading process. That's the same as that works in C++.

  • 相关阅读:
    一步步学习SPD2010--第十一章节--处理母版页(10)--重置母版页到网站定义
    pandas转numpy并打平实例
    list和numpy互相转换
    pandas转numpy
    pandas库疑难问题---2、pandas切片操作
    pandas切片操作
    pandas中的iloc和loc用法的区别
    NumPy疑难问题---1、NumPy切片操作
    numpy切片操作
    python疑难问题---13、Python切片操作
  • 原文地址:https://www.cnblogs.com/CUCmehp/p/1551472.html
Copyright © 2011-2022 走看看