The title already contains my question.(adsbygoogle = window.adsbygoogle || []).push({});

Here's the same thing in other form, just in case the title isn't clear: Is it possible that the following function returns 1, or is it always 0?

There's two possibilities. Either the probability for 1 is precisely zero, or then the probability 1 is something very small but non-zero.Code (Text):

x = rand();

y = rand();

return (x == y);

I'm programming with c, and this is a rand-function that requires stdlib.h to be included.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Can c rand give two consecutive equal numbers?

Loading...

Similar Threads for rand consecutive equal |
---|

Testing floating point numbers for equality |

Fortran Output of max consecutive values/days |

**Physics Forums | Science Articles, Homework Help, Discussion**