# NOT RUN {
c1<-.4; c2<-.6
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C);
n<-10 #try also n<-100
set.seed(1)
runif.bastri(1,c1,c2)
Xdt<-runif.bastri(n,c1,c2)
Xdt
summary(Xdt)
plot(Xdt)
dat<-runif.bastri(n,c1,c2)$g
Xlim<-range(Tb[,1])
Ylim<-range(Tb[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Tb,xlab="",ylab="",xlim=Xlim+xd*c(-.01,.01),ylim=Ylim+yd*c(-.01,.01),type="n")
polygon(Tb)
points(dat)
# }
Run the code above in your browser using DataLab