Fixed a bug in getRandomPoint function