Posts: 280
Threads: 34
Joined: Aug 2013
Reputation:
0
I had a question, I made a dice system for my server and in there I've used SAMP random function.
I want to know if there is a way to know the upcoming 3 number( I know this doesn't make it random ) But if I roll a dice is there a way to know which number is going to be next. Because SAMP uses pseudo-random number and according to wiki this random function isn't fully random, and I learnt from somewhere where it says computer cannot just generate random numbers but follows a special sequence to generate a number for you.
If someone who is expert at this can explain me how SAMP itself uses random function to generate number?
I'd appreciate.
Posts: 3,133
Threads: 71
Joined: Dec 2013
Reputation:
0
The random function generates a random integer value(I am not sure what it's based on) within the range of 0, and the given parameter(max param).
Basically: - any number between 0 up to(and or equal to) the max can be chosen. I am not really entirely sure as I wrote above exactly how the number is generated, but if someone told you its not random they're wrong.
There is no way to predict which one will be chosen next without actually calling the function, and retrieving the value.
Posts: 280
Threads: 34
Joined: Aug 2013
Reputation:
0
Uhm, Thought there was a way.
Posts: 2,203
Threads: 154
Joined: Oct 2009
Reputation:
0
Well simple answer to your question will be NO.
Yes computers can not generate random numbers, they must use some pattern to archive random number, and if you know these pattern than you COULD predict numbers. But there are more factors except pattern and its a magic number(s) that is/are used to generate random number. Most random number generators i know depend on at least two things. First is magic number and second is computer current time (timestamp). Knowing pattern without these numbers is useless, plus these numbers are known to mutate (timestamp for example...)
Posts: 734
Threads: 8
Joined: Jun 2009
DRIFT_HUNTER is right - I managed to find the code for the "random" function and it indeed takes a timestamp and the so called "magic number" is just the number of times the function was called, and does calculations with it. So there's really no way for you to predict what the number might be.
Posts: 280
Threads: 34
Joined: Aug 2013
Reputation:
0
That's awfully weird a guy I know made a application which would show the upcoming random number. I don't know how he did it but he had a neat video demonstration. He deleted that from ******* and is not willing to leak the application.
Posts: 280
Threads: 34
Joined: Aug 2013
Reputation:
0
Anyone got any clues ideas?