LabView Notes 3: Three methods to implement dice games based on LabView[Copy link]
This post was last edited by Mr_Dai on 2018-11-9 16:05LabView Notes 3: Three methods based on LabView to implement dice games Method 1: Use statistical method to randomly generate a one-dimensional array (I generated 10 numbers), and then use conditional structure to select the numbers corresponding to the six sides. Each time the condition is met, add one number, count the cumulative number of times the condition is met, and then calculate the probability. Method 2: Use statistical method, randomlygenerate a one-dimensional array(I generated 10 numbers), and then select whether the numbers corresponding to the six faces are equal. Every time the condition is met, add once, count the cumulative number of times the condition is met, and then calculate the probability. Method 3: Use array method, randomlygenerate a one-dimensional array(I generated 10 numbers), find a number in the positive sequence array (any number in the six faces), and then reverse the array to get the reversed array, and then subtract the number of the reversed number from the total number (10), and then subtract the number of the previous positive sequence number from the result, and finally get the number of a certain number, and then find the probability of the number. In this way, a problem is found. If this number does not exist, the number 12 will be obtained. I used a selection method to solve this problem, that is, let the total number of times add 2, and then judge whether it is equal to 12. If it is equal to 12, it is 0, which solves the problem of the non-existence of this number and solves this bug. Below are the front panels and flowcharts of the three methods. . .