Modified the randomOn method to include a time delay