Should random number generator seeded by time ( srand(time(0))) be used in codechef question?
i found it in the settler’s solution
for this question------
What v have 2 do is that v are given coordinates of points n v have 2 find max points which r collinear(Some r collinear n some r not ), so obv without checking all points v can’t say the max no of points colinear on a Line .
But the settler’s solution shows that by generating random nos , he has selected only those points which are generated by the random no generator and checked if they r collinear on a line.
Strangely i copied the code n tried 2 execute it on CodeChef , at one time i got correct ans , but again i ran it n found incorrect ans (obv since all points haven’t been checked) and again i ran it n found correct ans , then again incorrect ans .
Should questions b solved in this way ,that v instead of checking all the points v check only those points generated by a random no generator which is seeded by TIME , to reduce the execution time?N the ans depends on luck only…
Should it b used ?