Full code available on github: https://github.com/Balastrong/wrand
Let's build a random weighted system you can use for loot tables or gacha, in Typescript. I show the walkthrough to write this piece of code with some bits of Test Driven Development. This is not a TDD tutorial, but you might learn something interesting in testing while writing your code.
You can also use my code by installing it in your project with: npm i wrand
_______________________________
Hit like and subscribe for more content! :D
You can also follow me on the other platforms:
Twitter: / balastrong
TikTok: / balastrong
Instagram: / devbalastrong
dev.to: https://dev.to/balastrong
GitHub: https://github.com/Balastrong
_______________________________
TIMESTAMPS
0:00 What you're going to see
0:36 Creating the core logic & Tests
1:30 Pick method
1:27 Core logic explanation
3:10 PickMany method
3:36 Code Optimization & Input validation
4:54 Utility and standalone methods
5:40 100% code coverage
5:57 Open Source - code on GitHub
6:18 Publish on npm and deno
On this page of the site you can watch the video online Test Driven Development (TDD) Example - RANDOM LOOT TABLE with a duration of hours minute second in good quality, which was uploaded by the user Dev Leonardo 15 August 2022, share the link with friends and acquaintances, this video has already been watched 560 times on youtube and it was liked by 14 viewers. Enjoy your viewing!