Hopefully I am posting this in the right place. I am currently trying to polish up an app I made for HMA Random Sampling using SwiftUI. Right now, when you go into the Random Sample screen, it automatically generates a random number between 0.001 & 0.999. To get it to generate a new number though, the app has to be closed and then reopened to get it to generate a new number.
What I would like to implement is a “Generate Random Number” button that when pressed, will generate a new number and put the results in the variable so that it will then update the screen with the new random number and use that random number for any subsequent math afterwards until the app is closed or the button is pressed again.
If you can point me in the right direction of a tutorial that would cover something like this, I would greatly appreciate it as all of my searches have left me coming up empty.