![]() ![]() I cannot guarantee that I will continue to update this as I am working full time on a big project right now, however I may make changes if I personally notice them or they are big issues that need to be addressed.įeel free to rework this module to your liking, however credit would always be appreciated Local randomNumber = randomObj:getNum() -Get a random number from that object Local randomObj = random2.new(1, 10) -Create the random object Local random2 = require(modules.Random2) -Obviously the module location is irrelevant Local modules = replicated:WaitForChild("Modules") local replicated = game:WaitForChild("ReplicatedStorage") Default is 1000, however I currently don’t see a use in setting a lower amount but the option is there.įor this example let’s say we want to generate a random number between 1 and 10. The amount parameter, which is optional, will set how many random numbers should be added to cache for the requested random object. Once you have created a random object all you need to do is call getNum and a random number will be returned within the scope of the random object’s min/max. Here’s how you create a new random object Random2 is fairly simple to use, it’s usage is similar to that of Random(). Once you have retrieved your key paste the key where it is indicated in the module. Click on the new key you created and copy the API key.A free license is available, however your requests will be very limited and most likely will not meet the required amount of requests, I have reached the limit of the free license just by testing in studio.Īn API key is required for this module to work. Random2 is free, of course, however you will most likely need to purchase a license on the website. Unfortunately if the http request fails a number generated using Random() will be returned, however a warning will be printed to let you know. ![]() All unused random numbers are cached so that they can be retrieved when another request is made (if they fall between the min/max values). Each http request returns a table of multiple random numbers within the requested scope so that no further http requests need to be made when requesting within those bounds. Since http requests are limited Random2 makes each random number request as efficient as possible. Random2 is rather simple, as it works by sending http requests to. But it does not require a key so if you don’t need quick results TrueRandom is an excellent alternative. However, TrueRandom uses ’s old API which is significantly slower. It was what I originally used to combat this problem. Random2 is inspired by, and works in a similar fashion to 's TrueRandom module. Random2 will give you the closest thing to truly random results. When making a game that relies heavily on numbers being truly random, it can be rather game-breaking at times when Roblox’s random number generator returns sub-par results. I’m sure a lot of you are familiar with how mediocre the random libraries provided by Roblox are, because I sure am. ![]()
0 Comments
Leave a Reply. |