Jump to content

Predict Random()


NiM
 Share

Recommended Posts

So in short I am wondering if there is a way to predict random numbers generated by a computer? I have gotten it so I can generate two sets of random numbers and they both equal each other when ran at the same time (that was the easy part), now I am trying to figure out if there is a way to make the second set predict what the first set is about to say... Any ideas?

Link to comment
Share on other sites

What you are trying to explain doesn't make any sense. Please post the code you have so far. The Random() function returns numbers in the range specified randomly. Predicting what numbers it will return with 100% accuracy is not possible. It is kind of like predicting the winning lottery ticket numbers or what the dice are going to roll in a game of craps.

From what I am reading now, you are asking if it is possible to predict the outcome of a random function.

Please read the above sentence one more time, just to make sure it sinks in. No it isn't possible, but guessing is. Just be prepared to fail a whole lot before you guess the right answer. If this isn't what you are asking, please explain more clearly and post some code that you have done. Currently, I have absolutely no idea where you are coming from. And asking if it is possible to accurately predict the result of the Random() function 100% of the time is oxymoronic. I am assuming you are going for correct predictions as much as possible.

Unless you do something like this:

ConsoleWrite("I predict that Random() will return 1"&@LF)
ConsoleWrite("Random()="&Random( 1 ,1, 1 )&@LF)
ConsoleWrite("Yes, I was right."&@LF)oÝ÷ ØƤxqË«jש­çbrبʶjwhû§rب+.¦Ú-êk¡¶X­Êíêkyض*'ʦi×¢h§ê[jÇ¢{az{¦mêëjxʬ¥ç"~'u©§¶­Æ¢wî²)à±éízwn뢺ÞrÔ¨ü¨ºÞv'-¶­E©Ý¢l"ZÞ¶êç×­Ø^~e£§«jk^®Ë)yÈçZºÚ"µÍ[ÛJKJ
You have a 50% chance that your guess for the above function will be correct.

Please post the code that you have thus far in addition to explaining what you want with is much detail as possible. Two sentences isn't a whole lot to go off of.

- The Kandie Man ;-)

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

There is no code other then some code to generate a list of random numbers and display it, just used 2 splash screens to show the numbers. But why is it not possible to predict the outcome? If you knew the algorithm couldn't you figure what is going to come out at a certain time? ... So that would be what I need the algorithm that is used to generate the random number, so I can input my own variables for what ever it uses till I got what I wanted? And for why I want to do this would be to figure out what are going to come out in a random number of strings, mostly for games such as World of Warcraft when you do /random.

edit** (also I just found out there is no way in hell of figuring out the WoW algorithm)

edit2** Hehe yeah there is no way to predict a random number because its not always set information it is making it on, Thanks for the response 'The Kandie Man'.

Edited by NiM
Link to comment
Share on other sites

So in short I am wondering if there is a way to predict random numbers generated by a computer? I have gotten it so I can generate two sets of random numbers and they both equal each other when ran at the same time (that was the easy part), now I am trying to figure out if there is a way to make the second set predict what the first set is about to say... Any ideas?

In theory if you know the algorithm used, the starting seed and some idea of how many numbers have been generated since the algorithm was last seeded you could predict the next value Random will return as the first example below shows.

In prcatice most programers will seed the algorithm using the computers clock which means you can not know what the seed is and therefor the sequence of generated pseudo-random numbers is unpredictable. see example 2

Example 1

#include <ARRAY.AU3>
Dim $RandomNumbers[11][2]
$RandomNumbers[0][0] = "Run 1"
$RandomNumbers[0][1] = "Run 2"

; initialise pseudo-random number generator with a Known value
SRandom ( 10 )
For $i = 1 To 10
    $RandomNumbers[$i][0] = Random(1, 100,1)
Next
; reinitialise pseudo-random number generator with a Known value
SRandom ( 10 )
For $i = 1 To 10
    $RandomNumbers[$i][1] = Random(1, 100,1)
Next
_ArrayDisplay($RandomNumbers, "Results with known seed")oÝ÷ ØLZ^Ù«­¢+Ø¥¹±Õ±ÐíIId¹TÌÐì)¥´ÀÌØíI¹½µ9ÕµÉÍlÄÅulÉt(ÀÌØíI¹½µ9ÕµÉÍlÁulÁtôÅÕ½ÐíIÕ¸ÄÅÕ½Ðì(ÀÌØíI¹½µ9ÕµÉÍlÁulÅtôÅÕ½ÐíIÕ¸ÈÅÕ½Ðì(ÀÌØí±½¬ôQ¥µÉ%¹¥Ð ¤((쥹¥Ñ¥±¥ÍÁÍÕ¼µÉ¹½´¹ÕµÈ¹ÉѽÈÝ¥Ñ Ù±Õɽ´±½¬)MI¹½´¡Q¥µÉ¥ ÀÌØí±½¬¤¤)½ÈÀÌØí¤ôÄQ¼ÄÀ($ÀÌØíI¹½µ9ÕµÉÍlÀÌØí¥ulÁtôI¹½´ Ä°ÄÀÀ°Ä¤)9áÐ(ìÉ¥¹¥Ñ¥±¥ÍÁÍÕ¼µÉ¹½´¹ÕµÈ¹ÉѽÈÝ¥Ñ Ù±Õɽ´±½¬)MI¹½´¡Q¥µÉ¥ ÀÌØí±½¬¤¤)½ÈÀÌØí¤ôÄQ¼ÄÀ($ÀÌØíI¹½µ9ÕµÉÍlÀÌØí¥ulÅtôI¹½´ Ä°ÄÀÀ°Ä¤)9áÐ()}ÉÉå¥ÍÁ±ä ÀÌØíI¹½µ9ÕµÉÌ°ÅÕ½ÐíIÍÕ±ÑÌÝ¥Ñ U¹­¹½Ý¸ÍÅÕ½Ðì¤

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...