title: How generate random number in range -10 to 10
body: <p>Hello I am developing one game in which object has to move around the screen on random position. i am using cocos2dx framework. my code is </p>
  
  <pre><code>CCSize winSize = CCDirector::sharedDirector()-&gt;getWinSize();
      int minY = HelloWorld::bird-&gt;getContentSize().height/2;
      int maxY = winSize.height - HelloWorld::bird-&gt;getContentSize().height/2;
      int minX = HelloWorld::bird-&gt;getContentSize().width/2;
      int maxX = winSize.width - HelloWorld::bird-&gt;getContentSize().width/2;
      int range = maxX - minX;
      int actualY = (rand() % range) + minY;
      int actualX = (rand() % range) + minX;
      //HelloWorld::bird-&gt;setPosition(ccp(actualX, actualY));
      CCActionInterval*  actionTo = CCMoveTo::actionWithDuration(3, ccp(actualX,actualY));
      HelloWorld::runAction(actionTo);
  </code></pre>
  
  <p>it is working But generating only positive number. so sprite is going out of screen. i searched for tutorial but did not get. </p>