What is str ? My first guess after quick glimpse at this code is that str has less elements than random value, so you are trying to access element out of range.
Btw. this code is not safe:
Qt Code:
  1. Ballon *temp=qgraphicsitem_cast<Ballon*>(itemno.at(i));
  2. if(temp->getText()==str[random])
  3. return;
To copy to clipboard, switch view to plain text mode 
What if at some point you will insert items that are not "ballons" ? temp will be NULL and calling temp->getText() will cause crash. Check it like this:
Qt Code:
  1. Ballon *temp=qgraphicsitem_cast<Ballon*>(itemno.at(i));
  2. if(temp and temp->getText()==str[random])
  3. return;
To copy to clipboard, switch view to plain text mode