Randomness- A billion dollar problem in Software Engineering [Math Mondays]
There is more to randomness than the libraries that you call to generate random numbers.
Hey, it’s your favorite cult leader here 🐱👤
Mondays are dedicated to theoretical concepts. We’ll cover ideas in Computer Science💻💻, math, software engineering, and much more. Use these days to strengthen your grip on the fundamentals and 10x your skills 🚀🚀.
To get access to all the articles and support my crippling chocolate milk addiction, consider subscribing if you haven’t already!
p.s. you can learn more about the paid plan here.
How would you generate a random number in a programming language of your choice? What are the procedures you would use to accomplish psuedorandom behavior in your software testing? These are some of the questions that any software developer will have to tackle throughout various points in their careers. And this is a crucial element in setting up/evaluating any experiments. Not accounting for randomness can completely break your results, leading you down suboptimal paths (as we covered here). But have you really stopped to think about what it means for something to be random- especially from a computing perspective? Turns out there is more to this than meets the eye.
In today’s piece of Tech Made Simple, we will be covering Randomness in the field of Computing. There is a lot more to randomness than the random number generator libraries that you will import at some point or another. There are entire teams dedicated to studying this phenomena.
Randomness and Software Engineering
What is Randomness- In regular usage, Randomness is the lack of predictability in an event or sequence of events. In software engineering, randomness can be used to generate different outputs for the same input, or to introduce unpredictability into a system. Before we proceed, I want you take a second to really think about how you would quantify something like Randomness. Is there are an absolute randomness (there is an upper limit to how random a process can be), or do things exist in shades of randomness? Questions like this can be crucial to deepening your understanding these topics (and can be very fun to think about). Feel free to reach out if you’d like to discuss your thoughts.
Why use randomness in software engineering?: There are many reasons why randomness can be used in software engineering. Some of the most common reasons include:
Testing: Randomness can be used to generate test cases that are more likely to uncover bugs. This is a technique I am a huge proponent of, as it allows you to uncover the robustness of your systems. Neflix has been a huge proponent of Chaos Engineering, which we covered here.
Security: Randomness can be used to generate cryptographic keys and other security-sensitive data.
Game/Content development: Randomness can be used to create more unpredictable and engaging games/content. Recently there has been talk of creating real-time dynamically changing content, so it’s
Machine learning: Randomness is a large part of training and AI. Regular readers of our sister publication, AI Made Simple, will know that it is a recurring theme when I discuss creating high-performance systems.
Other applications: Randomness can be used in a variety of other applications, such as load balancing, traffic routing, and image generation.
How to generate randomness: As alluded to in the meme, there are two main ways to generate randomness in software:
Pseudorandom number generators (PRNGs): PRNGs are algorithms that produce a sequence of numbers that appear to be random, but are actually deterministic. PRNGs are typically used in software engineering because they are efficient and easy to implement.
True random number generators (TRNGs): TRNGs generate random numbers from unpredictable physical sources, such as atmospheric noise or radioactive decay. TRNGs are more secure than PRNGs, but they are also more expensive and difficult to implement. There is also a lot of (nerd) fame in creating new generators for true randomness. If you find a better way to implement TRNGs, you will be surrounded with groupies (or atleast you will get a lot of messages on LinkedIn and Twitter).
When to use randomness- As with all powerful tools, it is important to carefully consider the use of randomness in software engineering, as it can introduce security risks and other problems. Certain overenthusiastic developers (le your lovely cult leader) often get carried with introducing extra randomness into solutions, where they are not required. It might make your solution more ‘correct’ and ‘rigorous’, but all those extra sources of chaos can be uneccersary for simple forecasting protocols. As with all else, use heaps of critical thinking and avoiding using Randomness unless you can convince your grandma that it’s absolutely critical.
Testing for Randomness- If you want to test how good the randomness of your system is, my personal recommendation is to use the Diehard tests. It sounds badass, the tests are intuitive, and works really well. Make sure you TPose in front of the mirror as your tests are running for maximum results.
As tech folk, it’s always good to take a look under the hood of some of the tools we take for granted. Randomness is often overlooked because of how trivial it seems, but it can make or break applications.
That is it for this piece. I appreciate your time. As always, if you’re interested in working with me or checking out my other work, my links will be at the end of this email/post. If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here. And if you found value in this write-up, I would appreciate you sharing it with more people. It is word-of-mouth referrals like yours that help me grow.
Save the time, energy, and money you would burn by going through all those videos, courses, products, and ‘coaches’ and easily find all your needs met in one place at ‘Tech Made Simple’! Stay ahead of the curve in AI, software engineering, and the tech industry with expert insights, tips, and resources. 20% off for new subscribers by clicking this link. Subscribe now and simplify your tech journey!
Using this discount will drop the prices-
800 INR (10 USD) → 640 INR (8 USD) per Month
8000 INR (100 USD) → 6400INR (80 USD) per year (533 INR /month)
Reach out to me
Use the links below to check out my other content, learn more about tutoring, reach out to me about projects, or just to say hi.
Small Snippets about Tech, AI and Machine Learning over here
AI Newsletter- https://artificialintelligencemadesimple.substack.com/
My grandma’s favorite Tech Newsletter- https://codinginterviewsmadesimple.substack.com/
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let’s connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819