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
This commit is contained in:
Tobias Doerffel
2008-09-16 14:02:53 +00:00
parent 570159868e
commit 84ab700f9c
2 changed files with 18 additions and 2 deletions

View File

@@ -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<jo_id_t>( rand() %
while( m_joIDs.contains( id =
static_cast<jo_id_t>( (jo_id_t)rand()*(jo_id_t)rand() %
EO_ID_MAX ) ) )
{
}