Jump to content

What exactly IS random.dat?


Recommended Posts

I have done some trials to see exactly what random.dat is. I'm still not 100% sure what it is, but hopefully this helps some people:

  • random.dat stays the same until it is deleted
  • It is always length 24 (the client will make an entire new random.dat if it is above length 25)
  • In the RS client, it is a RandomAccessFile object
  • It is always opened with the read and write permissions

The process when making a new random.dat:

  • If there is no random.dat, on client launch it will create one
  • At this point, it will contain a single character -  ÿ (hex -> 255/FF)
  • When your client logs in, it will increase in size from a single character to 24.
  • This file is never altered from then onwards, however there is something weird that I found that does write to the RandomAccessFile handler that holds the random.dat



random.dat is a "ht"

A ht ->
new ht(file, string, long)

IF (file.length >= long) delete file

b = new RandomAccessFile(file, string)
n = b.read();
if (n != -1 || !string.equals("r")) {
	write n in the first position

seek to 0

I believe that what this does is essentially make sure that the file is valid - if "n" was -1, it would mean that the read operation failed.


From what I have seen, I believe it might be better if, instead of fully removing random.dat or making a new, empty, read-only one, you should create a read-only random.dat with the hex character FF written inside. This is because it is written like so by the game itself, and therefore is a valid format (or so it thinks), and doesn't look as suspicious (considering it could just very well be a failed write operation after login - there are no stages where random.dat is empty). I will continue my espionage within the OSRS client to see if I can find anything else of interest regarding random.dat.


Good luck everyone!

  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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