# Help with srand () and rainbow table.

• 12-10-2011
Lagger
Help with srand () and rainbow table.
Ok, I am playing a game and let say that i want to upgrade my gear by linking items in it. The items give you a 22% linking chance. I know that in order to link i need numbers lower than 22000/100000. I know that anything under 22000 can be linked. In order to know at what time i can get a number under 22000 i need to use a rainbow table to get a timeframe and put it in the srand(). This is a guy trying to explain me how to do it, but since i do not know anything about the Rainbow table i cannot manage to do it.

Quote:

tell him this: srand(time) % 10000, you need the results of that mapped out into a rainbow table

for a timeframe

you used this

Code:

```#include <stdlib.h> #include <stdio.h> #include <time.h> int main(void) { int i; time_t t; srand((unsigned) time(&t)); for(i=0; i<10; i++) printf("%d\n", rand() % 100); return 0; }```
but you're thinking about it the wrong way
you will never be accurate enough trying it like that
You just want to output the results of srand()

Timestamp is just a really long number
and it's sequential

so, you can.... predict what... 12/2/2011 11:32:10 PM would be
exactly.
in a timestamp format

Now, if XXX game's RNG runs off the timestamp of the current time...
you can predict what it will generate
at 12/2/2011 11:32:10 PM
in the future.

So, a rainbow table just basically lists "all" the possible outcomes. I do 7 hours worth of times in my rainbow tables

Then I look for groups of time periods where linking % is high

because you just can't get accurate enough to know what exact server time is + the lag

So, you want to feed srand() with future times and map them out into a spreadsheet (excel or something)

Just small periods of time, then look at allllll the numbers under 22,000

because those are the ones that will link.
Or %%,000. whatever % it is

22,000 = 22%, etc.

and make a table with srand() outputs

then try to find a big group of low numbers

You want about... 2-3 seconds where 80% of the numbers are under your desired linking %. It's not hard to find if you have the output in front of you

Here are steps
1) pick day you want to link
2) find a 10-20 minute time period, predict their unix timestamps (just calculate, google it )
3) feed all those unix timestamps into srand() in order
4) save srand's output into CSV or some kind of output you can read
11:28pm
5) evaluate for 2-3 seconds of low numbers

I know this is a little be complicated but i hope any of you know, what i am trying to accomplish here.
• 12-10-2011
then
What are you talking about?? To begin with; what is your question? I did not see any question in your post. You are playing a game, okay, but – upgrading your gear; what gear? Linking items in it; what items? How are they linked in the gear? How can an item give you a linking chance? And where does the message that you have quoted come from???

??????????????????????????????????????????????????
• 12-10-2011
iMalc
I understand what this guy you're quoting is saying, but when used correctly, a pseudo random number generator doesn't work like that...

When used correctly srand is only called once when the program starts and then rand is called as required. The actual value that comes out of rand only depends on:
1. The initial value passed to srand, and
2. The number of times rand has been called previously.
Without knowing both of these then the only way to determine the next value is to observe a long series of consecutive outputs from rand and determine by painful elimination at what point during the random sequence we are, i.e. what the seed currently is. You also need to know what the program does with the output of rand, so you basically need it's source code.

You can only predict a time where the chance of getting a desired value is higher if either calls are made to rand at a fixed time interval, of if it is used incorrectly by calling srand more than once.

Now what this guy is saying here could be somewhat valid, but it would apply to a specific program that is probably written poorly such that it is somewhat exploitable.
Note that some of what he says certainly does not make sense, i.e. srand has no "results" as it has no return value.

What are you really asking for here? Are you asking how to write a program that allows you to cheat at some game?
• 12-10-2011
Lagger
This is what i am looking for. Let say that you want to link an item into another item. Most game give you a percent chance that you have to link that item.

for example

I am trying to link an item that gives me 100 stats bonus into my armor. I go to a blacksmith in the game to do it. When i am about to link the blacksmith gives me a 40% chance to link that item into my armor.

Now my question, How can i make sure that item links with a 40% chance? i do not want to fail so much anymore, so i am looking for way to make sure that i can link any item at almost any percent.

That guys that i quoted is trying to tell me how to do it, but i do not understand.
• 12-10-2011
then
rand() % 100 will give you a number between 0 and 99. To do something with num_percent percent chance, use the following:

Code:

```if (rand() % 100 < num_percent) {     // Do something } else {     // Don't do something }```
If num_percent is zero or negative rand() % 100 will never be less since it's a number between 0 and 99, and if num_percent is 100 or more rand() % 100 will always be less. You could also use RAND_MAX + 1 as a roof and multiply that with the chance you want the event to happen with and not take take the modulus of rand(), i.e.

Code:

```if (rand() < chance * (RAND_MAX + 1)) {     // Do something } else {     // Don't do something }```
where chance is a float or double between 0 and 1. srand() is only used to make the game behave differently every time you run it.
• 12-10-2011
Lagger
I said that but he said that is not accurate enough. After i wrote the code he said this to me
Quote:

yes, but you're thinking about it the wrong wayyou will never be accurate enough trying it like that
You just want to output the results of srand()

Timestamp is just a really long number
and it's sequential

so, you can.... predict what... 12/2/2011 11:32:10 PM would be
exactly.
in a timestamp format

Now, if XXXX's RNG runs off the timestamp of the current time...
you can predict what it will generate
at 12/2/2011 11:32:10 PM
in the future.

So, a rainbow table just basically lists "all" the possible outcomes. I do 4 hours worth of times in my rainbow tables

Then I look for groups of time periods where linking % is high

because you just can't get accurate enough to know what exact server time is + the lag

So, you want to feed srand() with future times and map them out into a spreadsheet (excel or something)

Just small periods of time, then look at allllll the numbers under 22,000

because those are the ones that will link.
Or %%,000. whatever % it is

22,000 = 22%, etc.

and make a table with srand() outputs

then try to find a big group of low numbers

You want about... 2-3 seconds where 80% of the numbers are under your desired linking %. It's not hard to find if you have the output in front of you

Here are steps

1) pick day you want to link
2) find a 10-20 minute time period, predict their unix timestamps (just calculate, google it )
3) feed all those unix timestamps into srand() in order
4) save srand's output into CSV or some kind of output you can read
11:28pm
5) evaluate for 2-3 seconds of low numbers
• 12-10-2011
Lagger
I know this is too complicated and a bit out of your fields. But i cannot think if any other way to get help, unless i ask help from the tech college that i am going to.
• 12-10-2011
then
Ehm, yeah it's out of our fields right, that's why we can't help you. Have you considered that the reason we can't help you is because you have only been speaking gibberish? It should be pretty clear from my first post that what you are saying makes no sense! If you can please fill in this form:

1. What exactly are you trying to do? __________________________________________________
2. What method have you planned to use when doing that? __________________________________________________
3. Who is this dude you're quoting and what is you conversation about? __________________________________________________
4. Now, what is your question again? __________________________________________________

• 12-10-2011
Lagger
What exactly are you trying to do?

I am trying to find a way to link an item with a 40% into a piece of armor in an online game MMORPG without failing so many times.

What method have you planned to use when doing that?

i need the results of srand(time) % 100000 mapped into a rainbow table, so that i can predict what would exactly be at a let's sat at 12/10/2011 11:41:40 pm in a timestamp format. Now if the game's RNG runs off the timestamp of the current time, I will predict what it will generate at 12/10/2011 11:41:40 pm in the future. The rainbow table will list all the possible outcomes in let's say 5 hours. Then i need to look for groups of time periods where the linking % is high, because i cannot get accurate enough to know what exact server time is plus the in game lag. The next thing i need to do is feed the srand() with the future times and map them out into a spreadsheet like excel etc...I need to look for a small periods of time in those 5 hours where the numbers go for under 22000, because those are the ones that i will be able to link and make a table with srand() outputs then try to find a big group of low numbers. I need to get 2-3 seconds where 80% of those numbers are under 22000.

here are the step he gave me
1) pick day you want to link
2) find a 10-20 minute time period, predict their unix timestamps (just calculate, google it )
3) feed all those unix timestamps into srand() in order
4) save srand's output into CSV or some kind of output you can read
11:28pm
5) evaluate for 2-3 seconds of low numbers

Who is this dude that you're quoting and what is you conversation about?

He is a person that used to play the game i am playing a long time ago. The conversetion is about how he can link his items with a 22% all the time with almost failing none at all, going from 100 tries and failing only 1 or 2 attempts with a 22% chance of success.

Now, what is your question again?

How can i do the same thing he did with the info he gave me which is the info i gave above where i quote the guy.
• 12-11-2011
then
Okay, thanks for being more clear. This other guy, has he successfully made it in this way? If not, this method seems highly unlikely to succeed if it's not known to work for this game. You seem to make some basic assumptions here:

1. The game is written in C or C++ or any other language in which some pseudo-random number generator exists which is equivalent to that in C++ (likely)
2. The game actually uses this function as its random number generator (it might do, yes)
3. The game uses rand() % 100 (or its equivalent) and compares it with the given percentage in order to find out if it links or not. (it might do)
4. The game calls srand() (or its equivalent) to re-initialize the pseudo-random number generator every second and uses the local server time as its random seed (highly unlikely)

So unless you know that this method actually works because someone else has previously used it successfully in this game I wouldn't be so sure it works. If it does work then maybe you also can successfully use this method. Good luck anyway.