One more solution.
Fixed the bug in random_on_weight.cpp
Add another soultion in random_line_in_file.cpp