A Quick Study of RNG for CF

February 25, 2017 12:08PM
TL;DR, it looks pretty dang random and evenly distributed.

Since a ton of questions are asked about randomness on Carrion Fields, I thought I'd do some checking of my own. I don't have access to the Carrion Fields code, but CF is based on ROM, which is based on Merc, which is based on DikuMUD. The key randomness functions in the code in ROM are rewritten from Merc, so it's unlikely that Carrion Fields reimplemented the code unless there was a good reason.

One of the most important random functions in Merc/ROM fighting is number_range(x,y), which returns a number between x and y. It's used in a lot of key functions used for determining things like save vs spell success/failure, damage from character/mob attacks, hp/mana/move regen, and whether dent breaks an item, among many others.

I wrote a quick program to call the number_range function to generate a number between 0 and 999, and to do so 1,000 times. I then ran that program 1,000 times. That generated 1,000,000 random values between 0 and 999. Below is a chart that shows the results: the primary y-axis (in blue) is the number of times the number on the x-axis was rolled; the secondary y-axis (in light-orange) shows the number of times the number on the x-axis was the first roll when the program was run. A perfectly even distribution would be 1,000 rolls of each number and 1 first-roll of each number.



I also checked on "streakiness" where the same number was generated multiple times in a row. Out of the million rolls, there were 1,035 times where the same number was generated twice in a row. There was only 1 time where the same number was generated three times in a row. The same number was never generated four or more times in a row



Edited 2 time(s). Last edit at 02/25/2017 12:30PM by Tolgrumm.
Subject Author Posted

A Quick Study of RNG for CF

Tolgrumm February 25, 2017 12:08PM

this thread makes me realize why i majored in finance and not computer science... nt

The Forsaken(VIP) February 27, 2017 11:07AM

How long did this run take? I ask because RNG being very fast matters for CF (n/t)

laearrist February 27, 2017 05:29AM

Verry little (details inside)...

Tolgrumm February 27, 2017 10:01AM

Re: A Quick Study of RNG for CF

Isildur(VIP) February 26, 2017 04:53AM

Re: A Quick Study of RNG for CF

Tolgrumm February 26, 2017 06:00AM

God you turn me on. (n/t)

Matrik February 26, 2017 07:32AM

Keep talking like that...

Tolgrumm February 26, 2017 07:47AM

I think you win the Matrik's Biggest ROFL From Dios award. (n/t)

Matrik February 26, 2017 08:13AM

Re: A Quick Study of RNG for CF

Kstatida February 26, 2017 01:49AM

Uh...

Tolgrumm February 26, 2017 02:51AM

lol :)

Kstatida February 26, 2017 03:16AM

Re: lol :)

Tolgrumm February 26, 2017 06:35AM

Random: It took a recent neutral char 13 tries to get protection evil from a potion. Those odds are 1 in 4096. (n/t)

saagkri February 25, 2017 05:06PM

Since I can't be bothered to do the maths

daurwyn(VIP) February 25, 2017 10:58PM

Huh - I don't need a calculator to know that you 100% lied about OOC shadow plane collusion.

Nurok February 27, 2017 06:36AM

There's nothing magical in getting 1 in 4000 chance case

Kstatida February 26, 2017 03:19AM

I once rolled doubles eight times in a row playing Monopoly (went to jail twice). Odds of that are 1 in 1,679,616. I thought it was pretty magical. (n/t)

saagkri February 26, 2017 06:28PM

Interestingly, if you remove the didgets 666 from 1,679,616, you get 1791, the year the U.S. established the National Bank as a...monopoly. Creepy. (n/t)

saagkri February 26, 2017 06:42PM

You just blew my mind man. NT

Sam February 27, 2017 01:38PM

Exactly...

Tolgrumm February 26, 2017 06:43AM

Dont forget that cf is not a single user

Quas February 25, 2017 01:53PM

Yes and no...

Tolgrumm February 25, 2017 03:56PM

For the programmers...

Tolgrumm February 25, 2017 12:24PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 97
Record Number of Users: 1 April 26, 2024
Record Number of Guests: 133 April 26, 2024