How to bend a mesh to get randomly generated roller coaster?

Hey, guys! I need to randomly generated roller coaster tracks. At the start I have only one straight segment of rails.
How to bend that straight rails to create some complex random generated curved mesh?

You may try Tubes - Creating Tubes | Babylon.js Documentation
Example -

You’ll need to write your own function to fill the array with nice random values.


Some other ideas that might be useful.

For curves you can randomize the parameters.