Random does not contain a definition for 'RandRange'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JulioYagami

I’m trying to use the Random class, but it returns this error:

Hard to answer without the error :wink:

TheFamousRat | 2019-02-10 17:54

If you were wondering, there is the rand_range() function.

Ertain | 2019-02-10 21:19

What is the problem ? Sorry I’m having trouble understanding the issue

TheFamousRat | 2019-02-10 22:21

:bust_in_silhouette: Reply From: Doodlebrisk

@TheFamousRat The error is in his title:
“Random does not contain a definition for ‘RandRange’”. I think you’re following the example for RandomNumberGenerator in the documentation which says that RandRange() is the C# equivalent of rand_range() in gdscript. I’m seeing the same error, and I was able to fix the problem by doing GD.RandRange(...), omitting the Random variable name entirely.