Tuesday, October 31, 2006

The funniest coding question

Found this on expert-exchange.com today:
hi all,

IntTemp = Int((255 * Rnd()) + 1)

I used above ASP.NET code. Problem is in " Rnd() "
Rnd() value is changing everytime.

What is the alternative for Rnd()? OR How will stop Rnd() value changes at everytime?

Thanks

Then someone responded with this:

change the 255 to a 0 and you'll get the same number each time.

No comments: