LCD shield problem

I am trying to get a random number generator sketch to work on my LCD shield, I can get it working fine when on serial monitor but as soon as I try with the shield it doesnt talk to it I am really new to this so might be a simple error I just dont understand my sketch is
#include <LiquidCrystal.h>

long randNumber;

byte buttonPin = 7; /Pin your button is connected to/

void setup()
{
Serial.begin(9600);
Serial.println(“Press Button…”);
pinMode(buttonPin, INPUT_PULLUP);

// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function.
randomSeed(analogRead(0));
}

void loop() {
// print a random number from 100000 to 999999
randNumber = random(100000, 999999);
//Button will be continually checked
//once pressed, the program will enter this if statement
// and remain there until you release the button

if(digitalRead(buttonPin) == LOW)
{
Serial.println(randNumber);

//Begin software debouncing
//Delay time wait between pushes
while(digitalRead(buttonPin) == LOW) {}
delay(500);
}
}

I think the comment below might be a good clue.

// if analog input pin 0 is unconnected, random analog // noise will cause the call to randomSeed() to generate // different seed numbers each time the sketch runs. // randomSeed() will then shuffle the random function.

The shields I have used have Analog pin 0 used to get the keyboard input. Check your shield schematic, if your shield is connected this way, this method of getting a random seed won't work.

While you're checking the schematic, also make sure that pin 7 is not used by the shield. If it is, you may never be getting the initialization signal.

Hi Auds, and welcome.

arloG is right. It is very likely that the shield is using some pins that the original sketch is depending on. That's why you always need to check compatibility of shields. In this case a fix might be relative easy. But first you should tell more about what shield you are using. Is it a LCD Keypad Shield (you didn't state that) ? Because in that case you will have this problem. Picking an other analog input will not do if you plan on using the keys of that shield.

Also, before replying, read and follow this (click!). You'll learn how to use the forum correctly, as you seem not to have that under control yet.