Added weighted random sampling functions (#26).