traffic_gen.cc (10266:d4090f0cab30) | traffic_gen.cc (10348:c91b23c72d5e) |
---|---|
1/* 2 * Copyright (c) 2012-2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 409 unchanged lines hidden (view full) --- 418 419void 420TrafficGen::transition() 421{ 422 // exit the current state 423 states[currState]->exit(); 424 425 // determine next state | 1/* 2 * Copyright (c) 2012-2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 409 unchanged lines hidden (view full) --- 418 419void 420TrafficGen::transition() 421{ 422 // exit the current state 423 states[currState]->exit(); 424 425 // determine next state |
426 double p = random_mt.gen_real1(); | 426 double p = random_mt.random<double>(); |
427 assert(currState < transitionMatrix.size()); 428 double cumulative = 0.0; 429 size_t i = 0; 430 do { 431 cumulative += transitionMatrix[currState][i]; 432 ++i; 433 } while (cumulative < p && i < transitionMatrix[currState].size()); 434 --- 78 unchanged lines hidden --- | 427 assert(currState < transitionMatrix.size()); 428 double cumulative = 0.0; 429 size_t i = 0; 430 do { 431 cumulative += transitionMatrix[currState][i]; 432 ++i; 433 } while (cumulative < p && i < transitionMatrix[currState].size()); 434 --- 78 unchanged lines hidden --- |