开发者

Code only works successfully when passed the same values about half of the time [closed]

开发者_运维百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

I have a situation that has puzzled me for weeks. I am running logic that does a bit of back and forth to and from the database for each time it is executed (about 20 times). The problem is that the same code works about half of the time. What could possibly be the reason for the difference in execution performance and how can I better shore that this problem is checked?


When a function responds the same way with the same results each time it is given the same input, it is called a deterministic function. For example, SquareRoot() is deterministic (or should be). When it responds with a different value or potentially different value each time it is called the same way, it is a non-deterministic function. For example, Now() is non-deterministic, it provides a different time value each time it is called.

Your program is non-deterministic. Examine your code for typical kinds of non-deterministic behavior. I.e., timers, resource leaks, network timeouts, etc., etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜