Hello Everyone, I realized that the call to srand(time(NULL)) in my changes below may be contributing towards the same bucket being selected. Can you please tell me an appropriate function ( *main*()/*init*() ) to initialize the pseudo-random number generator (i.e. srand(time(NULL)))? Your help will be greatly appreciated. Thanks! // for stochastic switchingstatic const struct ofputil_bucket *group_best_live_bucket(const struct xlate_ctx *ctx, const struct group_dpif *group, uint32_t basis){ uint32_t rand_num = 0, sum = 0; const struct ofputil_bucket *bucket = NULL; const struct list *buckets; // initialize random seed srand(time(NULL)); // generate a number number in [1, 10] rand_num = (rand() % 10) + 1; group_dpif_get_buckets(group, &buckets); LIST_FOR_EACH (bucket, list_node, buckets) { sum += bucket->weight; if (rand_num <= sum) { return bucket; // return this bucket } } return bucket; // return NULL}
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev