#Determine fish type based on percentages.
4 messages · Page 1 of 1 (latest)
i can help you, dm me if you want me to. im not pro but i think this is easy enough
You're looking for weighted probability, there are a few ways you could go at this. The simplest one is on https://docs.godotengine.org/en/stable/tutorials/math/random_number_generation.html#weighted-random-probability, but if you google for it (godot-specific or not) there are a lot of examples
Godot Engine documentation
Many games rely on randomness to implement core game mechanics. This page guides you through common types of randomness and how to implement them in Godot. After giving you a brief overview of usef...
try this:
var dict : Dictionary = {1:12, 2:10, 3:8, 4:2, 5:6, 6:13, 7:18, 8:3, 9:100 - 72}
func get_random_index():
var randomValue = randf()
for i in dict.size():
if randomValue < dict[i]:
return i
return 9