Hey there, i got a problem
come on… plz try it. it is tiny code!
Have you tried Debugging? Besides that, I see you using rand() a couple of times, if you say your problem is ‘sometimes it works, sometimes not’, then you could try echoing their values, tracing the problem back to where the bug is.