cc.Class({
    extends: cc.Component,

    properties: {
      icons:{
          default:[],
          type:cc.SpriteFrame,
      },
      pos:cc.Vec2, 
      number:0,
      sfIndex:0,
    },

    // use this for initialization
    onLoad: function () {
    this.initSpriteFrame();
    },
    initSpriteFrame:function(){
        this.sfIndex =getRandomInt(0,this.number)
        var sprite = this.getComponent(cc.Sprite)
        sprite.spriteFrame = this.icons[this.sfIndex]
    }
});
function getRandomInt(min,max){
    var ratio = Math.random();
    return min + Math.floor((max - min)*ratio)
}