```
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
:type numsSize: int
"""
self.nums = nums
def pick(self, target):
"""
:type target: int
:rtype: int
"""
import random
pos = random.randint(0, len(self.nums)-1)
while self.nums[pos] != target:
pos = random.randint(0, len(self.nums)-1)
return pos
```