A rookie problem that generates random numbers

Updated on technology 2024-02-08
15 answers
  1. Anonymous users2024-02-05

    rand() returns a random value ranging from 0 to rand max. Returns a random value between 0 and rand max, which is defined as , (with a value of at least 32767).

    printf( "%", rand()/;This results in a number from 0 to 1 ... And so on.

  2. Anonymous users2024-02-04

    I don't know much about JSP, but I know how to do it, so I'll tell you about it.

    It's just another random number.

    Use an array a(n) x to generate randomly, and then attach the random number of Lazeliang to a(x), and then output ** at the same time to determine whether a(1) to a(n) is = random number, if = output.

    n is equal to the number of cells of **.

    The fan wheel circumference of x random marking number is greater than or equal to the number of grids of **.

  3. Anonymous users2024-02-03

    import ;

    public class text18

    if(a[i]==2)

    if(a[i]==3)

    if(a[i]==4)

    if(a[i]==5)

    if(a[i]==6)

    The probability of occurrence of 1 is:"+account1);

    The probability of occurrence of 2 is:"+account2);

    The probability of occurrence of 3 is:"+account3);

    The probability of occurrence of 4 is:"+account4);

    The probability of occurrence of 5 is:"+account5);

    The probability of 6 occurring is:"+account6);}

  4. Anonymous users2024-02-02

    1.Use the built-in method to generate a random number between 0 and 1.

    2.Forced to the int type, according to the characteristics of the int type, this number is an integer between 0 and 5.

    3.The resulting number is added to 1 so that the number is an integer between 1 6 and is random.

    4.Assign this integer between 1 and 6 to randomnum5Probability is an array, and the algorithm for this program is:

    The array of probability is used to record the number of occurrences of random numbers, and probability[0] records the number of occurrences of random number 1, that is, when the random number is 1, the probability[randomnum-1] term of the array is added to 1 (randomnum-1 is to represent the algorithm, and there is no need to add 1 and then subtract 1 in the actual program). The same goes for other arbitrary numbers.

    Thus, in the array of probability, the [0] item holds the number of occurrences of 1, and the [1] item holds the number of occurrences of 2 .........

    6.Output the value of the random number (followed by a space "t") 7Cycle through to step 1steps.

  5. Anonymous users2024-02-01

    =rand()*1550-1)+1 will generate the random number you want, but with multiple decimal places. =round(rand()*1550-1)+1 ,0)。You can generate an integer.

    Pull down the formula to generate as much as you want.

  6. Anonymous users2024-01-31

    Step by step:

    40 random numbers are generated, pasted into fixed numbers, and duplicates and redundant are eliminated.

  7. Anonymous users2024-01-30

    A1 input =round(rand()*1549+1,0).

    Drop-down formula filling.

  8. Anonymous users2024-01-29

    Add one.

    Command button and a label control, in the command button, type:

    1 + int (41 * rnd()) is shown when the command button is clicked, a random number between 1-41 is generated.

    Do you have a toolbox of controls.

    Ah, in layman's terms, for example, if you are in 2007.

    Click on the icon in the upper left corner, which is where you can select the "Save As" button, click on the "PowerPoint Tab" Common" function display area, and check the box in front of the "Development Tools" tab.

    This way you have a toolbox of controls.

    Then find an icon with the letter a, which is the label control, and a square piece is the command button, and after drawing the command button, double-click it, and the macro screen is here.

    private sub commandbutton1_click()= 1 + int(41 * rnd())end sub

    In the middle, paste it into the top line.

  9. Anonymous users2024-01-28

    Ah, in layman's terms, for example, if you are in 2007.

    Click on the icon in the upper left corner, which is where you can select the "Save As" button, click on the "PowerPoint Tab" Common" function display area, and check the box in front of the "Development Tools" tab.

    This way you have a toolbox of controls.

  10. Anonymous users2024-01-27

    It is formed bit by bit, at home. o(∩_o~

  11. Anonymous users2024-01-26

    Who wasn't a rookie in the first place?

    Depends on what you think of the rookie.

  12. Anonymous users2024-01-25

    The program you gave is completely fine, it does generate random numbers.

    But there is something wrong with your understanding. It's the same before and after, it's not that it's not "random".

    When you flip a coin, heads and tails are completely random, but it's possible to have heads or tails both times.

  13. Anonymous users2024-01-24

    The mechanism of the C++ random function rand should be generated by a fixed polynomial according to the seed you give the seed, and the random number generated when you have the same seed must be the same.

    So a lot of times we use time as a seed, and time is different from moment to moment, so the random numbers that must be generated are also different.

    The second method should be fine with just putting srand(time(0)) in the loop. The first method is also, although manual seeding is not in favour

  14. Anonymous users2024-01-23

    Please note that the random number function of C++ is a pseudo-random number function, not a real random number function, it generates random numbers according to the value of the set seed, even if the time function is used to make the seed, for today's computers, it is impossible to use 1 second to run such a simple program... Note: The return value of time(0) is from 00:00 on January 1, 1970

    00 to the total number of seconds up to now...

    Do you understand???

  15. Anonymous users2024-01-22

    **There is no problem, but you just take the random number of 1 6, and also take 6000 times (the latter program), can you not repeat?

    You look at it this way:

    int main()

    return 0;}

Related questions