Correlating randomly placed images with slider

I am trying to correlate randomly placed images with a slider widget (1-100). How do I do this?

–random image function

local rando = display.newImage(“Image.png”, cx, cy)

rando:scale(.5, .5)

rando.x = math.random(rando.width*momoney.xScale/2, cw-rando.width*rando.xScale/2)

rando.y = math.random(rando.height*rando.yScale/2, ch-rando.height*rando.yScale/2)

–slider

– slider event handler

function sliderHandler( event )

    print("event.phase = "…event.phase)

    sliderValue = event.value

    

    print( "Slider at " … sliderValue … “%” )

    – slider goes between 0 and 100

    

    Txt = getValueInRange(event.value, 1, 50)

    NumberTxt.text = Txt

end

function getValueInRange( value, v_min, v_max )

    value = v_min + value*(v_max-v_min)/100

    return math.floor(value) 

end

– background gradient

– the slider

slider = widget.newSlider {

    id = “slider”,

    x = cx, – not sure why this isn’t exactly centered on cx?

    y = cy-200,

    width = .88*cw,

    value = 0,

    listener = sliderHandler – if it mattered, could register with different listener fn

}

– onscreen text objects

NumberTxt = display.newText("", cx, cy-170, f, 30)

–random image function

local rando = display.newImage(“Image.png”, cx, cy)

rando:scale(.5, .5)

rando.x = math.random(rando.width*momoney.xScale/2, cw-rando.width*rando.xScale/2)

rando.y = math.random(rando.height*rando.yScale/2, ch-rando.height*rando.yScale/2)

–slider

– slider event handler

function sliderHandler( event )

    print("event.phase = "…event.phase)

    sliderValue = event.value

    

    print( "Slider at " … sliderValue … “%” )

    – slider goes between 0 and 100

    

    Txt = getValueInRange(event.value, 1, 50)

    NumberTxt.text = Txt

end

function getValueInRange( value, v_min, v_max )

    value = v_min + value*(v_max-v_min)/100

    return math.floor(value) 

end

– background gradient

– the slider

slider = widget.newSlider {

    id = “slider”,

    x = cx, – not sure why this isn’t exactly centered on cx?

    y = cy-200,

    width = .88*cw,

    value = 0,

    listener = sliderHandler – if it mattered, could register with different listener fn

}

– onscreen text objects

NumberTxt = display.newText("", cx, cy-170, f, 30)