|
||
|
|||||||
| Modification Suggestions This is where you can suggest a modifcation to RunUO! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Newbie
Join Date: Jan 2006
Age: 32
Posts: 45
|
Im just curious of the Utility.Random Methods are working correctly or not. How are these derived? I feel they are running off the system clock cycle. If this is true, then I dont think this is the best way to run this. It could potentially cause Errors in the Hitting Effects, spell casting, or anything else that runs the Utility.Random Methods. I guess what im asking is if your running a Random Seed or if your running off the system clock.
I only ask this because people tend to Hit 5x in a row, then miss 5 or more times, hit 1 time, miss 10 times, hit 10 times, miss 1 time..ect. Something just seems fishy about this. And since most of your code runs off the Utility.RandomDouble() stuff. Is it possible that there is no randomseed generation? How many Cycles does it take for the System to Generate a random item? If it dont take but x amount of cycles. If its running off the clock. and the item is generated at 0.0002302 then ends at .0005323? The random function isnt really doing its job. This is just my thoughts on whats actually going on. Didnt know if this was worth looking into. Thanks for reading. |
|
|
|
|
|
#3 (permalink) | |
|
Newbie
Join Date: Jan 2006
Age: 32
Posts: 45
|
Quote:
|
|
|
|
|
|
|
#4 (permalink) | ||
|
Forum Expert
|
Quote:
Quote:
Notice the bolded word? |
||
|
|
|
|
|
#5 (permalink) |
|
Account Terminated
|
Plus the part where I said I know the random function in the default code were used in the correct way.
So everyone knows is the Utility's Random functions use the .NET Framework code to generate random numbers. Its just has specfic methods to generate numbers specfic for our use. I doubt that they use randomseed generation method, considering thats stuff that companies pay alot of money for since the calculations are so advanced. Plus the fact you wouldn't really want that code, since it would take so much system resouces to calculate a "fake" random number. Clearly a computer cannot generate a "true" random number, there will always be what appears to be a "pattern" since its just how the computer works. |
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
|
They use system time (tickcount) when the class was instantiated as seed, but over the time when you call one of these methods the internal seed changes.
Next(); Next(int maxValue); Next(int minValue, int maxValue); NextBytes(byte[] buffer); NextDouble(); More information here http://msdn2.microsoft.com/en-us/lib...em.random.aspx
__________________
|
|
|
|
|
|
#7 (permalink) | |
|
Account Terminated
|
Quote:
I wasn't really postive of which method was used, I just know it works as well as it should, since I have used the random generation in VB .NET back in 2001 |
|
|
|
|
|
|
#8 (permalink) |
|
Newbie
Join Date: Jan 2006
Posts: 44
|
I've noticed the same thing... casting ev's I'll fizzle 5 times, then cast 4 times. I think the random utility should just be replaced with the systime, and use the modulous function to get a number between 0-100
Everything that has a % chance of being successful could then be compared to that number. If the % chance is higher than the "random" number returned, then the attempt was a success. And by systime I mean the timer that gives you thousandths of a second. |
|
|
|
|
|
#9 (permalink) | |
|
Administrator
Join Date: Aug 2002
Location: Baltimore, MD
Age: 25
Posts: 4,832
|
Quote:
The internal random number generator is working perfectly fine. Just because it sometimes "feels" like its not random doesn't mean its true.
__________________
Zippy, Razor Creator and RunUO Core Developer The RunUO Software Team "Intuition, like a flash of lightning, lasts only for a second. It generally comes when one is tormented by a difficult decipherment and when one reviews in his mind the fruitless experiments already tried. Suddenly the light breaks through and one finds after a few minutes what previous days of labor were unable to reveal." ~The Cryptonomicon |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|