<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mora Larsen</title>
    <description>The latest articles on DEV Community by Mora Larsen (@moralarsen).</description>
    <link>https://dev.to/moralarsen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3193207%2F2efa2a3d-571c-4716-8ad5-824d76f617c8.png</url>
      <title>DEV Community: Mora Larsen</title>
      <link>https://dev.to/moralarsen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moralarsen"/>
    <language>en</language>
    <item>
      <title>Randomness Algorithms in Games: Development Experience and Questions for the Community</title>
      <dc:creator>Mora Larsen</dc:creator>
      <pubDate>Wed, 25 Jun 2025 12:12:07 +0000</pubDate>
      <link>https://dev.to/moralarsen/randomness-algorithms-in-games-development-experience-and-questions-for-the-community-51e7</link>
      <guid>https://dev.to/moralarsen/randomness-algorithms-in-games-development-experience-and-questions-for-the-community-51e7</guid>
      <description>&lt;p&gt;I'm working on my own game and have been seriously thinking about how to implement RNG. I'm not just interested in calling a built-in &lt;code&gt;random()&lt;/code&gt; function — I want to understand how number generation works under the hood. I want the system not only to appear random but also behave consistently in tests. The challenge isn't generating a number, but integrating that number fairly into game logic where balance and player experience matter. I'm experimenting with different pseudo-random algorithms, looking into how Mersenne Twister behaves, and considering custom seeding based on player input.&lt;/p&gt;

&lt;p&gt;To understand how it’s done by bigger studios, I looked at how online game providers implement RNG — specifically Pragmatic Play. Their slot games show stable randomness while maintaining a predictable RTP. The way they balance visual dynamics with probability mechanics is impressive. Games like Gates of Olympus or Sweet Bonanza use RNG not just to spin reels, but to determine cascading wins and multipliers that shape the emotional rhythm of the gameplay. I read a &lt;a href="https://unionslots.co.uk/pragmatic-play/" rel="noopener noreferrer"&gt;full overview&lt;/a&gt; of Pragmatic Play's games and paid attention to how bonus logic is built — all tied to an internal randomness system that the player doesn’t see, but definitely feels.&lt;/p&gt;

&lt;p&gt;I'm curious — as fellow developers, what approaches do you take when implementing RNG in your projects? Do you build something custom, or rely entirely on standard library generators? And how do you test your system for true unpredictability without compromising game balance?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Dealing with Dynamic Typing in Python: How I Tackled Type-Related Bugs in My Project</title>
      <dc:creator>Mora Larsen</dc:creator>
      <pubDate>Fri, 06 Jun 2025 10:19:31 +0000</pubDate>
      <link>https://dev.to/moralarsen/dealing-with-dynamic-typing-in-python-how-i-tackled-type-related-bugs-in-my-project-1md9</link>
      <guid>https://dev.to/moralarsen/dealing-with-dynamic-typing-in-python-how-i-tackled-type-related-bugs-in-my-project-1md9</guid>
      <description>&lt;p&gt;In a recent project, I was building a backend system for a web application using Python. The system was handling user data, payments, and various APIs, and I started noticing issues where functions were receiving arguments of unexpected types. For example, I would pass a string instead of a number or vice versa, which led to runtime errors that were difficult to detect during development.&lt;/p&gt;

&lt;p&gt;The project had grown large, and multiple contributors were working on different parts of the system. Without strict type checking, the codebase became prone to silent bugs that weren't noticed until later stages of testing. This caused delays and frustration, especially when the issues were hard to reproduce or pinpoint.&lt;/p&gt;

&lt;p&gt;How I Solved the Issue: Adding Type Hints and Using Static Analysis&lt;br&gt;
Adopting Type Hints:&lt;br&gt;
I started by adding type hints to my functions. This helped me specify the expected types of function arguments and return values, making the code more readable and self-explanatory. It also allowed me to catch type mismatches earlier in the development process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def calculate_total(price: float, quantity: int) -&amp;gt; float:
    return price * quantity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After adding type hints, I used &lt;code&gt;mypy&lt;/code&gt;, a static type checker for Python, to verify that the types were being used correctly throughout the codebase. This was an essential step in catching any type errors before they made it into production. Running &lt;code&gt;mypy&lt;/code&gt; as part of my development process allowed me to catch issues like passing a string to a function expecting a number.&lt;/p&gt;

&lt;p&gt;To further ensure that the types were being correctly handled, I wrote unit tests for critical functions. While unit tests don’t directly check types, they helped me confirm that the data passed through functions was valid and that functions were returning the expected values. I also integrated Pylint, another static code analysis tool, into my workflow. This tool helped identify other issues in my codebase, like unused variables, potential bugs, and places where I could optimize the code.&lt;/p&gt;

&lt;p&gt;By adding type hints and using tools like &lt;code&gt;mypy&lt;/code&gt; and Pylint, I was able to eliminate most of the type-related bugs early in the development process. The codebase became much more maintainable and readable for new contributors, and the chances of introducing hidden bugs were greatly reduced.&lt;/p&gt;

&lt;p&gt;The static type checking also made it easier to spot errors during the code review process, as the expected types were now clearly defined. This allowed the team to catch problems before they were merged into the main codebase, improving the overall quality of the project.&lt;/p&gt;

</description>
      <category>python</category>
    </item>
  </channel>
</rss>
