Real melodies are not random. However, it is an interesting exercise to start with a random scrap of tune and use it to develop a melody. You can flip a coin or pick cards from a deck or use anything else to pick a sequence of notes. Or you can use a computer.
Here is a program to write three kinds of random tunes. A White tune has all notes equally probable, and a Brownian tune has each note only one step from the previous note. A Pink tune is halfway between. The names come from "white noise", "brown noise", and "pink noise", in acoustic engineering.
The tunes are shown as a sequence of numbers representing notes of a scale. For example, if the tune is
1 2 3 1 1 2 3 1
you would sing it
do re mi do do re mi do
In the key of C, it would be
c d e c c d e c.
Pink tunes are in extended do re me form, where di, ri, fi, si, li are the notes a semitone above do, re, fa, so, and la, and du is do an octave up. Tunes are also shown in guitar tab, in the key of C.
Your tune goes here