Dear Emad,
randomPoints function comes from the dismo package not sdm, so try loading the package first and re-run the function:
library(dismo)
(backgr <- randomPoints(predictors, 500)
# An example:
library(raster)
library(dismo)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
RP <- randomPoints(mask = r, n = 200)
plot(r)
points(RP)
Hope it works with you,
Cheers,
Ahmed