added very basic weighted random for choosing an edge