added weightedrandom + tests