Episode: 2262 Title: HPR2262: Abstracting Nurse Jesus Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2262/hpr2262.mp3 Transcribed: 2025-10-19 00:31:02 --- This in HPR episode 2,262 entitled Amtracting Urcemas, it is hosted by Eric Newhamel and is about 5 minutes long, and Karina Cleanflag, the summary is how Amtracted random number generation for more syntactic sugar. This episode of HPR is brought to you by AnanasThost.com. Get 15% discount on all shared hosting with the offer code HPR15, that's HPR15. Get your web hosting that's Honest and Fair at AnanasThost.com Hello hacker public radio listeners, I am Eric Newhamel. Among other hobbies I am a video game developer, and my last weekend I realized that although I can get a random number generally by writing one line of code, it is nevertheless useful to wrap these things inside a method. In Python you can get a random number by calling random rand int and giving it a couple of numbers to help choose from, or you can have Python choose randomly from a list by calling random choice and supplying it with a list. A method is a series of commands that can be executed by calling the methods name, and if you make a method and give it a name that makes sense for what the series of commands does, this is called syntactic sugar, and this is a way of making it easier to read your code and understand what it does quickly. So I wrote the following methods to help my program generate randomness in a more readable way. I am going to go ahead and read the name of the method, describe the arguments that it takes, and describe the data that it returns, because I forgot to mention that that's how methods generally work. Get choice takes a single list and returns a random piece from that list, and you can tip the odds in favor of any of the choices by simply adding more of that choice to the list, more instances of that choice, just like rigging a lottery. Get chance takes two numbers in the form of reading the odds of winning, and for instance 3,720 to 1, and it'll return true if it happens to land on that one. I figure take chances would be a better name for this method, but I feel that the more boring the methods in a game engine are, the more useful it's going to be. And lastly, get number takes a number, and returns a number between that number and 0. Optionally, you can supply it with a second number, and it'll then return a number between the first number and the second number, which should be lower. I should add some sort of a check to make sure that. Now these methods are also universally useful that I realized all three classes of objects in Megan and Engine would need to have access to them. So I decided to make a super class that contained all of these methods, and all three classes of objects could become children of, and therefore have access to the methods. And now any object in the engine can call self-get choice, or self-get chance, et cetera, in order to generate randomness without me having to import the random submodular at the top of the code. This is how I used methods and syntactic sugar to make objects more independent and self-sufficient, and easier to read besides. By way of explanation, I'm titling this episode, Abstracting Nurse Jesus, in tribute to a pun I started hearing from my wife first, and then it started hearing it in several gaming fora, uh, that is video gamers. The first I heard it was the acronym RNG, which stands for Random Number Generator, which is something that I normally only heard in programming parlance, but I was hearing gamers start to use it. Mostly gamers who were angry at completely randomized rewards for otherwise hard tasks in a video game, where you could complete a task or a mission that was really, really hard and end up with a really low-powered reward of armor or weapons. As it turns out, the first two letters in RNG, which is RN, also stands for Registered Nurse, and G happens to be the first sound in the slang term G's, or Jesus, which is usually an expression of exasperation. So that's where the phrase Nurse Jesus comes from, and it means Random Number Generator. And it seems to be usually and most hilariously used in a phrase, uh, like, praying to Nurse Jesus, presumably for better rewards. Alright, until next time, happy hacking everyone. You've been listening to Hacker Public Radio at HackerPublicRadio.org. We are a community podcast network that releases shows every weekday Monday through Friday. Today's show, like all our shows, was contributed by an HBR listener like yourself. If you ever thought of recording a podcast, then click on our contributing to find out how easy it really is. Hacker Public Radio was founded by the Digital Dog Pound and the Infonomicon Computer Club, and is part of the binary revolution at binwreff.com. If you have comments on today's show, please email the host directly, leave a comment on the website, or record a follow-up episode yourself. Unless otherwise stated, today's show is released on the creative commons, attribution, share a like, 3.0 license.