# How to simulate different time points for each individuals

hi, iam trying to create a population where each individual is sampled at different time, i want one sample to be taken for each individual from time points between 1 to 12,
iam not able to use rand function, as it generates one random value and samples that particular value for all individual , can you please help me with this regards, Thank you

``````event1 = DosageRegimen(213,time = 0, ii=12,addl =1, ss=1)
#defining covariates
cov() = (; wt = rand(2.5:35),
age = rand(1:12))
#population
pop1 = Population(map(
i-> Subject(; id=i, events = event1, covariates = cov()),
1:42))
timepoints = rand(1:12,42)
#simobs
sim2 = simobs(model1,pop1,param1, obstimes= timepoints)

``````

Hi Pavan,

I have modified some part of your code to get the solution you are looking for. Can you please check and see if this is what u intended to do.

``````event1 = DosageRegimen(213,time = 0, ii=0,addl =0, ss=0)
#defining covariates
cov() = (; wt = rand(2.5:35),
age = rand(1:12))
#population
#Select the time points randomly
Random.seed!(123)
timepoint = rand(1.0:12.0,42)
timepoints(x) = timepoint[x]
pop1 = Population(map(
i-> Subject(; id=i, events = event1, time=[timepoints(i)], covariates = cov()),
1:42))
df_pop1 = DataFrame(pop1)
#simobs
sim2 = simobs(model1,pop1,param1)
``````