By referring to here...

https://forums.terraria.org/index.php?threads/where-to-find-purple-slime-in-mobile-terraria.48249/
Source code for the Terraria ver 1.2.4. (PC version)

"NPC.cs" (line 37224)

if (Main.rand.Next(10) == 0 && num47 > 400)

{

Main.npc[num31].SetDefaults("Purple Slime");

}

For what I understand, it means,

Random number from 0 to 9, if then number generated are 0, AND,

"World Map tiles count" more than 400 it will assign the Purple Slime to spawn.

Since you call yourself a decent programmer, you should fully understand the above (

green) code.

**I have no time to go dig out the item drop chances code, you are welcome to do so at GitHub and share it here. I believe they using the same .rand.*

So,

in actual coding, a simple "

If" statement, to have rand(10) = 0.

To increase the rarity of the spawn, one just increase the "x", rand(x).

Example:-

Blue Slime -

if (Main.rand.Next(2) == 0)
Green Slime -

if (Main.rand.Next(3) == 0 || num47 < 200)
Yellow Slime -

if (Main.rand.Next(5) == 0)
Purple Slime -

if (Main.rand.Next(10) == 0 && num47 > 400)
Clear, make sense and easily understand.

----------------------------------------------------------------------------

Next, Lets see specifically how "C# generate random number".

In this articles

http://csharpindepth.com/Articles/Chapter12/Random.aspx
It state nothing about probability.

You say, this has nothing to do with programming, but just the concept of probability in general. (That start to confuse people).

In the Terraria code, it use 'instance of Random repeatedly'.

It does not use "cryptographic random number generator". (I've checked).

I say, this is all come from original Terraria Source Code. And I do not refer to "probability in general".

----------------------------------------------------------------------------

Imagine this:-

rand.Next(100) in a "continuous sequence of kill", you can be sure that the chances of drop is 1/100. It will guaranty drop <=100 kills.

rand.Next(4000) in a "continuous sequence of kill", you can be sure that the chances of drop is 1/4000. It will guaranty drop <=4000 kills.

----------------------------------------------------------------------------

Refer back to initial 1st post. Its all about "retaining the same sequence of kill".

Back to example:-

rand.Next(4000) in a "continuous sequence of kill", you can be sure that the chances of drop is 1/4000. It will guaranty drop <=4000 kills.

If you quit the game, and play it later, the new rand.Next(4000) are initiate. And the new random start over again.

You might get it the 1st kill (if you lucky), but you might never get it, if you constantly quit the game before getting one.

-----------------------------------------------------------------------------

line1: Imagine you have a room with 52 different doors, so a person has a 1/52 chance to enter through any specific door.

line2: What you have calculated is the chance of one person coming in through one of *n* different doors.

line3: What you are supposed to calculate is the chance of at least one of *n *people coming through one specific door.

line1: 1/52. Simple.

line2: the "chances of" 1/n. (n different door, which in this case n is 52 doors).

line3: the "chances of" n/1. (Which n is people, which is unknown, and door = 1. If people is 52 then 52/1 is 52. If door is 52, and people is 52, then 52/52=1)

Nice twist over. But mathematically not applicable. Your logic is seriously flawed.