We already have a code published here that could generate random points inside an irregular raster boundary using R. If you want another option, below is an R code to
Updates
From The Blog
The scientific community hides me behind the initials EAL Salas
PhD in Geospatial Science and Engineering, Specialization in Remote Sensing
From The Blog