I see one definite problem and one possible one. The definite problem is that sizeof(objectList)
returns the size of the objectList
pointer, which will be 4 or 8 on most platforms. It does not return the number of elements in the array, objectList
. Either pass in the length of the array or use std::vector
or std::array
.
The second possible problem relates to ofRandom
. Make sure that ofRandom(a,b)
returns numbers >= a, but strictly < b. If it returns values <= b, then you'll need to us ofRandom(0, objectVector.size() - 1)
. Typically, functions like this are written to return values strictly < b, but you should check.