Hey! Not sure if you found the resources you need yet, but here is some info:
Confusion lasts 2-5 turns. I don't think this has changed across generations. It's important to note that if a Pokemon is unable to execute an attack for another reason, such as recharging or full paralysis, this turn will not count towards the number of confusion turns.
Sleep in gen 3 lasts 2-5 turns, unless it's from Rest or if the Pokemon has the Early Bird ability. Early Bird will halve the number of sleep turns and possibly cause the Pokemon to wake up immediately. If a Pokemon uses Sleep Talk but does not "burn" an actual turn of sleep (i.e., not attacking), its sleep counter will reset upon switching out.
EDIT: And to answer your specific question, the duration is random. The Pokemon has the same probability to have any one of the durations. So the average sleep time or confusion time would be 3.5 turns.