Ok, as the title would suggest, this tutorial will teach you how to generate an ore in minecraft

Ok, so what we need to start off doing, at the top of your mod_YourMod, were you had typed "package net.minecraft.src;", underneath that you need to put the line of code;
Code:
import java.util.Random;
so once you've done this, you need to go to the bottom of ur file (this is preferable so you dont get confused as much) and u need this bit of code here;

Code:
    public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
        for(int i = 0; i < 4; i++)
        {
            int randPosX = chunkX + rand.nextInt(16);
            int randPosY = rand.nextInt(16);
            int randPosZ = chunkZ + rand.nextInt(16);
            (new WorldGenMinable(mod_YOURMOD.YOURORE.blockID, 3)).generate(world, rand, randPosX, randPosY, randPosZ);
        }
    }

i will go through this line of code as to what 3 of the crucial numbers mean

so the for(int i = 0; i < 4; i++) this tells minecraft how rare the ore wants to be, the number you need to change is the 4 because this is how rare it is for example lets take diamond as an example the 4 in this is replaced with 1 so this giv u an idea of how rare diamond is.

anyway onto the next number we need which is the "int randPosY = rand.nextInt(16);" this 16 stands for what depth that the ore will be found at, so again taking diamond for an example diamond is set to 16 and that is near the bottom of the map

and finally the last number "mod_YOURMOD.YOURORE.blockID, 3" this 3 stands for the maximum amount of that ore can be found in a vein of ore and again diamond is 7 so in diamond you could find a maximum of 7 diamond in one vein

If any more help dont hesitate to post it in the reply below and Good Luck !