Move random to the core

and clean imports