If you don’t know what Random.org is, check it out. It uses atmospheric noise to generate randomness, which will end up being much more “truly” random than pseudo-random generators (like `math.random`

). So if you need some better randomness, this is a good library to use. Of course, it has to make an HTTP call and thus is much slower than calling `math.random`

, but perhaps useful for generating seeds and such.

I spent a couple hours today writing a library to interface with Random.org’s API. It was pretty straight-forward since their documentation was well-detailed.

To use this library, you have to register for a beta key, which they will just email to you. Then you pass that key to the library’s `Init`

function.

Here’s some quick examples:

```
local randomOrg = require(game.Whatever.RandomOrg)
randomOrg.Init("YourApiKeyHere")
--
local diceRoll = randomOrg.Integer(1, 6)
print(diceRoll)
--
local manyDiceRoll = randomOrg.Integer(1, 6, 10) -- 10 rolls
for i = 1,#manyDiceRoll do
print("Roll " .. i .. ": " .. manyDiceRoll[i])
end
--
local uuid = randomOrg.UUID()
print(uuid)
--
local chance = randomOrg.Decimal()
if chance > 0.5 then ... end
--
local str = randomOrg.String(10, "abcdefg1234567")
print(str)
--
local usage = randomOrg.GetUsage()
for key,value in pairs(usage) do
print(key, value)
end
```

Here’s a list of all the methods:

```
Random.Init(apiKey)
Random.GetUsage()
Random.Integer(min, max [, count])
Random.Decimal([count])
Random.Gaussian(mean, standardDeviation, significantDigits [, count])
Random.String(length, characters [, count])
Random.UUID([count])
Random.Blob(size [, format, count])
```

**Note:** If “count” is provided and is not 1, then the result is instead a `table`

with the results.

The “format” for Blob can either be “base64” or “hex” and defaults to base64 if not provided.

The minimum/maximum/ranges/etc. for the parameters can be found within the ModuleScript source itself, or on the API web page I linked in the first paragraph.

**Disclaimer:**

This is *slow*! It in no way is trying to compete with the speed of `math.random`

at all. Every function call has to make an HTTP call. There are limits on your API key, which can be watched using the GetUsage function. I made this more as a fun little project, but I hope someone is able to use it somehow practically.