//長方形の形式の抽選結果を返す func CreateRectForm() RectForm { lot := lottery.New(rand.New(rand.NewSource(time.Now().UnixNano()))) forms := []lottery.Interface{ horizontalLong, verticalLong, square, } result := lot.Lots( forms..., ) return forms[result].(RectForm) }
//マップ難易度の抽選結果を返す func (game_map *GameMap) initMapDifficult() { lot := lottery.New(rand.New(rand.NewSource(time.Now().UnixNano()))) difficults := []lottery.Interface{ easy, normal, hard, exhard, } result := lot.Lots( difficults..., ) game_map.Difficult = difficults[result].(Difficult) }