I'm using a diamond-square algorithm for my random generated maps. You may want to read this:

Diamond-square algorithm

This is my implementation in GDScript. I'm using a custom class (*mi*arr) to store the result, you should modify it to use an array.

```
_width = pow(2, map_factor) + 1
_height = _width
var passes = 0
var r = rand_range(0, 60)
var dir = -1 if randf() < 0.5 else 1
while(passes<4):
var step_size = (_width - 1)
while(step_size > 1):
var x = 0
while(x < _width - 1):
var y = 0
while(y < _height - 1):
diamond_step(x, y, step_size, r * dir)
square_step(x, y, step_size, r * dir)
y += step_size
x += step_size
step_size /= 2
r -= 4
r = clamp(r,0,60)
passes += 1
```

Diamond

```
func diamond_step(x, y, step_size, r):
var avg = (_mi_arr.get_value(x,y) +
_mi_arr.get_value(x,y + step_size) +
_mi_arr.get_value(x + step_size, y + step_size) +
_mi_arr.get_value(x + step_size, y)) / 4
_mi_arr.set_value(x + step_size/2, y + step_size/2, avg + r)
```

Square

```
func square_step(x, y, step_size, r):
var avg = (_mi_arr.get_value(x,y) + _mi_arr.get_value(x+ step_size,y))/2
_mi_arr.set_value(x + step_size/2, y, avg + r) #up
avg = (_mi_arr.get_value(x,y + step_size) + _mi_arr.get_value(x + step_size,y+ step_size))/2
_mi_arr.set_value(x + step_size/2, y + step_size, avg + r) #down
avg = (_mi_arr.get_value(x,y) + _mi_arr.get_value(x,y+ step_size))/2
_mi_arr.set_value(x, y + step_size/2, avg + r) #left
avg = (_mi_arr.get_value(x + step_size,y) + _mi_arr.get_value(x + step_size,y + step_size))/2
_mi_arr.set_value(x + step_size, y + step_size/2, avg + r) #right
```

You can probably do this by binding a noise library (such as OpenSimplex or FastNoise) as a GDNative library, which doesn't require to recompile the engine in 3.0.

Alternatively, you could write a shader to generate a texture that you can then download from the GPU to GDScript to make up your map, which will be even faster than a C++ generator, but also trickier^^