title: Everything about RANDOMNESS in Godot
sources: https://www.youtube.com/watch?v=lckgjXM3CeE
media_link: https://www.youtube.com/watch?v=lckgjXM3CeE
Authors:
- "[[MrElipteach]]"
contentPublished: 2022-11-20
noteCreated: 2025-01-27
description: In this video I go over different ways of getting random number but most importantly, how to use these techniques in game!🎓 Learn how to make JUICY games 👇https://www.udemy.com/course/learn-how-t
tags:
- clippings
- video
takeaways:
subjects:
- "[[RandomNumberGenerator|RandomNumberGenerator in Godot]]"
-
Status: ✅ Read
publish: true
Youtube_Duration: 11:33In this video I go over different ways of getting random number but most importantly, how to use these techniques in game!
🎓 Learn how to make JUICY games 👇
https://www.udemy.com/course/learn-how-to-make-a-game-juicy-in-godot-4/?referralCode=1652C74B848551E05DAE
USEFUL STUFF
🔗 Video about noise
https://www.youtube.com/watch?v=sChQCdbLdHE
🔗 RandomNumberGenerator
https://docs.godotengine.org/en/stable/classes/class_randomnumbergenerator.html
🔗 Random number generation tutorial
https://docs.godotengine.org/en/stable/tutorials/math/random_number_generation.html
🔗 Random element with weighted probability
https://github.com/godotengine/godot-proposals/issues/3948
🔗 Value vs reference
https://www.bogotobogo.com/cplusplus/valuevsreference.php
👤 SOCIALS
💰 One time donation: https://ko-fi.com/mreliptik
💰 Support me on Patreon: https://patreon.com/MrEliptik
🟣 Join us on Discord: https://discord.gg/83nFRPTP6t
🔴 Twitch: https://twitch.tv/mreliptik
🐤 Twitter: https://twitter.com/mreliptik
🎥 TikTok: https://www.tiktok.com/@mreliptik
🖼️ Instagram: https://www.instagram.com/mreliptik
🔗All links: https://bento.me/mreliptik
func _on_WeightedBtn_pressed() -> MyObject:
var result = randf()
if result < 0.1:
return objects[0]
elif result < 0.7:
return objects[1]
else:
return objects[2]
A better solution would be to use a dictionary, but this requires a more complex algorithm.