Others.Random(1, 3); // always returns 1 Others.Random(2, 3); // always returns 2 //etc
Matenia 624 Posted November 22, 2022 Share this comment I'm sure this worked on TBC back in the day. Currently definitely broken on Vanilla. Link to comment Share on other sites More sharing options...
Droidz 2722 Posted November 23, 2022 Share this comment Hi, I just tested (on latest version for Vanilla) and it works : Link to comment Share on other sites More sharing options...
Matenia 624 Posted November 23, 2022 (edited) Share this comment I did the same test yesterday (exact same in development tools). Maybe it was a bad seed or something. My computer had already been running all day. Edit: Just did it again and it still always reports 1 - this is WRobot 32758. I can get it to work if I execute it before even starting the bot (Quester). If I use it while the bot is running without ever using it before, it will ALWAYS result in 1. For now, I just made my own implementation in my quester profile to work around. Edited November 23, 2022 by Matenia Link to comment Share on other sites More sharing options...
Droidz 2722 Posted November 23, 2022 Share this comment Random code is simple internal static readonly Random Rng = new Random(unchecked((int)DateTime.Now.Ticks)); /// <summary> /// Return Random number. /// </summary> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <returns>System.Int32.</returns> public static int Random(int from, int to) { try { return Rng.Next(from, to + 1); } catch (Exception exception) { Logging.WriteError("Random(int from, int to): " + exception); } return 0; } What is your value of unchecked((int)DateTime.Now.Ticks) Link to comment Share on other sites More sharing options...
Droidz 2722 Posted November 23, 2022 Share this comment and value of (int) DateTime.Now.Ticks (I'm not sure robotManager.dll is up to date) Link to comment Share on other sites More sharing options...
Matenia 624 Posted November 23, 2022 Share this comment For now, I can't reproduce it anymore (5 minutes ago, It was possible - idk!). If I can reproduce it again, I will put the values of Ticks checked and unchecked here. Droidz 1 Link to comment Share on other sites More sharing options...
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now