comparison src/EM.cpp @ 281:405a2ad601f4

drand48 isn't so portable and we don't really need high-quality randomness, use rand instead
author Chris Cannam
date Wed, 06 Aug 2014 16:44:44 +0100
parents 4e19c60241cb
children 26be240475b5 37d2d04d94db
comparison
equal deleted inserted replaced
280:8e94604ccff2 281:405a2ad601f4
43 m_sourceSparsity(1.2) 43 m_sourceSparsity(1.2)
44 { 44 {
45 m_pitches = allocate<float>(m_noteCount); 45 m_pitches = allocate<float>(m_noteCount);
46 m_updatePitches = allocate<float>(m_noteCount); 46 m_updatePitches = allocate<float>(m_noteCount);
47 for (int n = 0; n < m_noteCount; ++n) { 47 for (int n = 0; n < m_noteCount; ++n) {
48 m_pitches[n] = drand48(); 48 m_pitches[n] = float(rand()) / RAND_MAX;
49 } 49 }
50 50
51 if (useShifts) { 51 if (useShifts) {
52 m_shifts = allocate_channels<float>(m_shiftCount, m_noteCount); 52 m_shifts = allocate_channels<float>(m_shiftCount, m_noteCount);
53 m_updateShifts = allocate_channels<float>(m_shiftCount, m_noteCount); 53 m_updateShifts = allocate_channels<float>(m_shiftCount, m_noteCount);
54 for (int f = 0; f < m_shiftCount; ++f) { 54 for (int f = 0; f < m_shiftCount; ++f) {
55 for (int n = 0; n < m_noteCount; ++n) { 55 for (int n = 0; n < m_noteCount; ++n) {
56 m_shifts[f][n] = drand48(); 56 m_shifts[f][n] = float(rand()) / RAND_MAX;
57 } 57 }
58 } 58 }
59 } else { 59 } else {
60 m_shifts = 0; 60 m_shifts = 0;
61 m_updateShifts = 0; 61 m_updateShifts = 0;