How does Yi Language achieve randomness at the microsecond level?

Updated on technology 2024-05-21
19 answers
  1. Anonymous users2024-02-11

    I just thought of using threads, and I wrote a accumulation, and found that the accumulation is about one-tenth of a millisecond, and after replacing the random number, the cycle time is longer.

    Since I've written it, I'll post it to you by the way.

    Version 2 supports the library ethread

    Assemblies Window Assembly 1

    Assembly variables are cyclic or not, logical.

    Subroutine button 1 is clicked.

    Start the thread (& loop plus, whether to loop true.)

    Subroutines are added in a loop.

    Local variable a, integer type.

    Local variable b, integer type.

    The local variable c, an integer.

    Determine the first cycle (whether the cycle is true).

    a takes a random number (,bb a

    Box 1Content to text (b).'Box 1 is used to show the result of adding random numbers.

    c = c + 1

    Box 2Content to text (c).'Box 2 is used to show the number of cycles.

    Judge the end of the cycle ().

    This loop does not consume system resources.

    Subroutine button 2 is clicked.

    Count the first cycle (5, ).'Because the cycle is accelerated too fast, if you want to stop the cycle immediately, you will do 5 consecutive cycles.

    Whether the cycle is false.

    Counting cycle tail ().

    The subroutine Startup Window is created.

    Set the random number seed ().

    I don't know if it's right, I'll give you a reference and you can try.

  2. Anonymous users2024-02-10

    Yes, with a clock.

    Version 2 Subroutine Clock 1 Cycle Events.

    Launch the window. Title to text (take a random number (, the subroutine Startup Window is created.

    Set the random number seed ().

    Subroutine button 1 is clicked.

    Clock 1Clock cycle 1

  3. Anonymous users2024-02-09

    Can be replaced with threads. But they are not the same principle.

  4. Anonymous users2024-02-08

    If you don't know anything about Yi Language, you can come to the Huaxia Alliance to ask for advice, there are many masters.

  5. Anonymous users2024-02-07

    .Version 2Assemblies Window Assembly 1

    Subroutine button 1 is clicked. Local variables Random numbers, integer types, random number seeds, random numbers, random numbers (1, 10).Judgment Start (random number 8) subroutine 1 ().

    The default Subroutine 2 () judgment endsSubroutine Subroutine 1 Title "Subroutine 1".

    Subroutine Subroutine 2 Title "Subroutine 2" Add a button to the window to take it.

  6. Anonymous users2024-02-06

    .Version 2

    Set the random number seed ().

    If (take the random number (0, 10) 8) subroutine 1 ().

    Otherwise subroutine 2 ().

  7. Anonymous users2024-02-05

    Doesn't Yi Language have a command called a random number ()? You can use this command to get it, you can write it like this.

    Box 1Content to text (take a random number (1, 100)) will do.

  8. Anonymous users2024-02-04

    Set the random number seed ().

    Box 1Content to text (take a random number (1, 100)).

  9. Anonymous users2024-02-03

    Hello,This question is actually using the easy language to take the random number (),It's quite fast.,Such a random function.,There's no need to compare which one is the fastest.。。

    There is also a way to get random numbers through assembly, but I think it is better to take random numbers () This is the most practical, and it is called directly!

    Hope mine helps you! Kiss the piglet.

  10. Anonymous users2024-02-02

    Add a clock to the window clock period = 6000 Clock period event Write take random number () That's about it, where do you need to apply the random number! You can add ** yourself.

  11. Anonymous users2024-02-01

    Add a clock, set the clock period to 6000 (i.e. equal to 6 seconds), double-click the startup window to write**.

    Version 2 Subroutine Clock 1 Cycle Events.

    Take a random number (0, 9).'0 is the minimum number to be taken, 9 is the maximum number to be taken, which can be modified here.

  12. Anonymous users2024-01-31

    .Version 2Assemblies Window Assembly 1

    Assembly Variables Number of rows, integer.

    Assembly variables: word count, integer.

    Assembly Variables Text Group, Textual, ,0"

    The subroutine Startup Window is created.

    Box 1Content Fill in some content in the randomly generated content first, and then click the generate button".

    Set the random number seed ().

    Box 2Whether multiple lines are allowed true.

    Box 2Scrollbar 2

    Variable loop at the beginning (1, take the length of the text (Box 1.)content) 2, 2, word count).

    Join the members (text group, take the text in the middle (Box 1.)Content, Word Count, 2))Variable loop tail ().

    Subroutine button 1 is clicked.

    Box 2Contents

    Input box (, please enter: number of rows", 5", number of rows, enter integer)The first count of the cycle (number of rows, ).

    The number of words is taken as a random number (1, and the length of the text is taken (Box 1.)Contents) 2).The first count of the cycle (number of words, ).

    Box 2Add text (text group [take random number (1, take array members (text group))].

    Counting cycle tail ().

    Box 2Add text (line breaks).

    Counting cycle tail ().

  13. Anonymous users2024-01-30

    First assign 10 boxes to the array, and then randomly 1-3 to decide how many numbers appear this time, and then count the cycle according to the number of random times just now, and then sort, and finally add text on the line, try it.

  14. Anonymous users2024-01-29

    .Version 2

    Local variables Random, Integer, ,"5"

    Set the random number seed ().

    Random number [1] Take random number (1, 11)Random number [2] Take random number (1, 11)Random number [3] Take random number (1, 11)Random number [4] Take random number (1, 11)Random number [5] Take random number (1, 11).

  15. Anonymous users2024-01-28

    .Version 2

    Subroutine button 1 is clicked.

    Local variable 1, integer type.

    Local variable 2, integer.

    Local variable 3rd, integer.

    Local variable 4th, integer.

    Local variable No. 5, integer.

    Set the random number seed ().

    The first one takes a random number (0, 11).

    The second one takes a random number (0, 11).

    The third one takes a random number (0, 11).

    The 4th takes a random number (0, 11).

    The 5th takes a random number (0, 11).

    Box 1Content to text (1st) to text (2nd) to text (3rd) to text (4th) to text (5th).

  16. Anonymous users2024-01-27

    Set the random number seed ().

    The first one takes a random number (0, 11).

    The second one takes a random number (0, 11).

    The third one takes a random number (0, 11).

    The 4th takes a random number (0, 11).

    The 5th takes a random number (0, 11).

  17. Anonymous users2024-01-26

    .Version 2

    Assemblies Window Assembly 1

    Subroutine button 1 is clicked.

    Local variables, variables, textual.

    Set the random number seed ().

    Variables to text (take random numbers (0, 100)) to output debug text (variables

    I just did it myself, I hope it can help you.

  18. Anonymous users2024-01-25

    To make the problem clear, this function should be a number from 0 to 10, so the probability of each number is 10%, isn't it?

  19. Anonymous users2024-01-24

    .Version 2

    Support for the library ethread

    Support for library specs

    Start the thread (>. Random Test, 100, ).

    Subroutines are randomly tested.

    Parameter times, integer type.

    Local variables are counted, integers.

    Local variables random, integer type.

    Local variables occurrences, integers, ,"11"

    Local Variables Result, Textual.

    Set the random number seed ().

    The first count cycle (times, counts).

    Random number (0, 10).

    Occurrence [Random 1] Occurrence [Random 1] 1Counting cycle tail ().

    Results The first count cycle (11, count).

    Result Result to text (count 1) to text (number of occurrences [count] line break).

    Counting cycle tail ().

    Debug output (result).

    It turns out that the probability of occurrence is not much different from 10 11.

Related questions
15 answers2024-05-21

Easy language. Ways to close the window:

1. First of all, in the open home page of Easy Language, open the Easy Language software environment. >>>More

19 answers2024-05-21

Box 1**=http read file("http: ***.")

Execute it once, and change the verification code once. >>>More

19 answers2024-05-21

Version 2 Subroutine button 1 is clicked.

Clock 1Clock cycle 10'10 here is the meaning of ten milliseconds, that is, ten milliseconds go once, adjustable. 1000 milliseconds = one second. >>>More

13 answers2024-05-21

Write to file command depends on how to use the command Space to collect disciples.

19 answers2024-05-21

The main building is to supplement the computer knowledge, the text type () is just text, and it is impossible to store any information about the color and size of the text. That is, the text of the infobox cannot be changed in its "style". Your so-called font size, font color, and tilt only exist in window controls such as boxes and labels, so you might as well use the "font" class. >>>More