🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Random Integer Problem

    UIFlow
    2
    2
    1.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Hawksey
      last edited by

      I'm trying to generate a new random number every time the unit gets reset/rebooted but it always returns the same number, 6 in this case. Any thoughts on how this could be done? Is it a bug in Random Integer? It will be running on an ATOM Lite (testing on a Core2 so I see it on screen)

      0_1700735595822_uiflow_block_1700735577078.png

      1 Reply Last reply Reply Quote 0
      • H
        holofloh
        last edited by

        According to https://xkcd.com/221/ the random number should be 4 :-)
        In reality a randomizer will just be an algorithm to create numbers and often they get initialized by a timer. So if you always start the same code after reset and read the number it seems to met always the same initialisation. I miss a function to "randomize" the initialisation. Try to do it by any loop/function before that delays in a random way e.g. connection to wifi or read from a noisy AD channel until a specific value is read.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post