Apply random linear velocity to a rigid body 3D when it spawns.

I have a rigidbody that spawns and I want it to shoot randomly.

func _ready():
	linear_velocity.y = get_random_f_amount(5, 10)
	linear_velocity.z = get_random_f_amount(-2.5, -1.5)
	linear_velocity.x = get_random_f_amount(-2.5, -1.5)
	
func get_random_f_amount(min, max):
	var rng = RandomNumberGenerator.new()
	rng.randomize()
	var to_return = rng.randf_range(min, max)
	return to_return

This works, but it shoots only to the left.
Am I doing this wrong ?

Thanks !

Your random ranges for the linear_velocity components are not symmetrical. If you want an equal probability of the ball to move in every direction, you should have the min and max be the same number but opposite signs.

Is there a particular reason you used -2.5 and -1.5 as the range for x and z , and 5, 10 for y?

For the Y, it's so it shoots up and then goes down (That works fine)

For the x and z, I will try with symmetrical values.

Thanks !