From 84ab700f9c5be45adf6d5088a2b5cd1c0d403aa7 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 16 Sep 2008 14:02:53 +0000 Subject: [PATCH] improved usage of random number generator (closes #2109211) git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1616 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 15 +++++++++++++++ src/core/project_journal.cpp | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9f1134c3..13ffc32ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2008-09-16 Tobias Doerffel + * src/core/project_journal.cpp: + improved usage of random number generator (closes #2109211) + + * plugins/ladspa_effect/tap/tap_pinknoise.c: + * plugins/ladspa_effect/caps/interface.cc: + * src/core/drumsynth.cpp: + * src/core/main.cpp: + don't mis-initialize random number generator with default value + + * src/core/journalling_object.cpp: + print name of object which uses ID if another object requests it + + * src/core/automation_pattern.cpp: + make sure we don't return NULL in automationPattern::firstObject() + * plugins/ladspa_effect/ladspa_effect.cpp: * include/engine.h: * include/effect_rack_view.h: diff --git a/src/core/project_journal.cpp b/src/core/project_journal.cpp index 3d4a9ce9b..0bf0a6c0f 100644 --- a/src/core/project_journal.cpp +++ b/src/core/project_journal.cpp @@ -105,9 +105,10 @@ void projectJournal::journalEntryAdded( const jo_id_t _id ) jo_id_t projectJournal::allocID( journallingObject * _obj ) { - const jo_id_t EO_ID_MAX = 1 << 24; + const jo_id_t EO_ID_MAX = (1 << 23)-1; jo_id_t id; - while( m_joIDs.contains( id = static_cast( rand() % + while( m_joIDs.contains( id = + static_cast( (jo_id_t)rand()*(jo_id_t)rand() % EO_ID_MAX ) ) ) { }