Fast range function