When composing, there are many different approaches to take such as chance or patterns.
Chance is basically a method for when you’re stuck for inspiration. You get a dice and roll it, if the number is even then you’re in major, if it’s odd then it’s minor. You roll again to get your key and then roll 4 more times for the pattern. This is good for inspiration but you really need to check it by ear because sometimes it could sound unfinished, like if you end with a 5 or something.
Patterns is when you use the circle of fifths to compose a pattern and it helps you get a pattern which will definitely work well together. This is much more of an efficient way to work but if you’re stuck for ideas then chance can help a lot.