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++.

  • 相关阅读:
    15,scrapy中selenium的应用
    14,UA池和代理池
    13,scrapy框架的日志等级和请求传参
    12,scrapy框架之post请求
    11,scrapy框架持久化存储
    10,Scrapy简单入门及实例讲解
    09.移动端数据爬取
    08.Python网络爬虫之图片懒加载技术、selenium和PhantomJS
    07.验证码处理
    vue的ref与$refs
  • 原文地址:https://www.cnblogs.com/CUCmehp/p/1551472.html
Copyright © 2011-2022 走看看