13
0

Use g_random_int instead of ::random for portability

This commit is contained in:
Paul Davis 2013-07-11 11:38:46 -04:00
parent 27eecdc88b
commit f47499f157
4 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -781,9 +781,9 @@ unique_random_color (list<Gdk::Color>& 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);

View File

@ -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 */

View File

@ -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);