Update schedule.c

fixed lottery function