This sample code will generate a random number according to your post above.
<%
dim randomNumber
weightedRandomNo()
response.write "Weight - " & randomNumber & "<br>"
function weightedRandomNo ()
randomize timer
dim myArray(3)
weight = int(rnd(1)*3)+1
myArray(0) = int(rnd(1)*50)+1
myArray(1) = int(rnd(1)*50)+1
myArray(2) = int(rnd(1)*50)+1
myArray(3) = int(rnd(1)*50)+51
randomNumber = myArray(weight)
end function
%>
and this sample code shows how to insert a row into a database from a form.
http://www.aspwebpro.com/aspscripts/records/insertnew.asp