The general theory of randomly timed automata is developed: starting with the practical motivation and presentation of the envisaged notion, the categorical theory of minimization, aggregation, encapsulation, interconnection and realization of such automata is worked out. All these constructions are presented universally: minimization and realization as adjunctions, aggregation as product, interconnection as cartesian lifting, and encapsulation as co-cartesian lifting. Stochastic timed automata are shown to be a particular case of randomly timed automata. The notion of stochastic timed automaton is shown to be too restrictive to establish a self contained theory of combination and realization