Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Am I having a moment or is the math off?

> Given a random starting seed, rand_nsmb will repeat an output after 1,820,529 calls, on average.

> Longest cycle: 1 cycle of length 1,708,724



If you look at all the listed cycles, their total length is 2,664,154 or only about 0.06% of all the 32 bit integers. So 99.94% of all the integers first follow some linear path before eventually entering into one of the cycles. Now depending on the exact structure of the graph - are there a few long paths or are there many short paths entering into the cycles and into a cycle of which length do the different paths enter - the average sequence length until the first repetition across all starting points can be very different including longer than the longest cycle in case there are relatively few but long paths entering into the cycles.


I think the solution is that not every seed value is part of a cycle, but they might lead to a cycle.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: