Random generate in dynamic text field

Hello! Does anyone know how to randomly generate something to display in a dynamic text field. So far I have named the dynamic text field and in the actionscript I have called it, nothing comes up. I have search several places and still have not been able to solve the problem. However before I called the text box I tested my code with the trace function and It display in the output box but not the dynamic text box. Please help.

generateRandom = function() { /* Code I used to call the txt box does not wk.
display.text = Math.ceil(Math.random()*200);
function ranEquation(){

function ranEquation(){… /* this was used first to randomly generate and works with the trace function