added randomRange function