From f47499f1579c47a15ebcdbcdc5f830748b05cc3c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 11 Jul 2013 11:38:46 -0400 Subject: [PATCH] Use g_random_int instead of ::random for portability --- gtk2_ardour/ui_config.cc | 2 +- gtk2_ardour/utils.cc | 6 +++--- libs/ardour/broadcast_info.cc | 2 +- libs/ardour/test/midi_clock_slave_test.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 86f03bbd95..573e509ab9 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -278,7 +278,7 @@ UIConfiguration::color_by_name (const std::string& name) } // cerr << string_compose (_("Color %1 not found"), name) << endl; - return RGBA_TO_UINT (random()%256,random()%256,random()%256,0xff); + return RGBA_TO_UINT (g_random_int()%256,g_random_int()%256,g_random_int()%256,0xff); } void diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index d4bc460269..eb3f4ab55d 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -781,9 +781,9 @@ unique_random_color (list& used_colors) const int32_t max_saturation = 48000; // 65535 would open up the whole color wheel - newcolor.set_red (random() % max_saturation); - newcolor.set_blue (random() % max_saturation); - newcolor.set_green (random() % max_saturation); + newcolor.set_red (g_random_int() % max_saturation); + newcolor.set_blue (g_random_int() % max_saturation); + newcolor.set_green (g_random_int() % max_saturation); if (used_colors.size() == 0) { used_colors.push_back (newcolor); diff --git a/libs/ardour/broadcast_info.cc b/libs/ardour/broadcast_info.cc index a7fa41aaf9..78c6132f85 100644 --- a/libs/ardour/broadcast_info.cc +++ b/libs/ardour/broadcast_info.cc @@ -84,7 +84,7 @@ BroadcastInfo::set_originator_ref_from_session (Session const & /*session*/) /* random code is 9 digits */ - int random_code = random() % 999999999; + int random_code = g_random_int() % 999999999; /* Serial number is 12 chars */ diff --git a/libs/ardour/test/midi_clock_slave_test.cc b/libs/ardour/test/midi_clock_slave_test.cc index dcb159cb2c..4349df22eb 100644 --- a/libs/ardour/test/midi_clock_slave_test.cc +++ b/libs/ardour/test/midi_clock_slave_test.cc @@ -27,7 +27,7 @@ MIDIClock_SlaveTest::testStepResponse () for (framecnt_t i = 1; i<= 100 * period_size; i++) { // simulate jitter - framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(random()) / double (RAND_MAX)) * one_ppqn_in_frames); + framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames); if (i % input_delta == 0) { update_midi_clock (*parser, start_time + i);