Math Functions in VBScript



This example uses the Int and Rnd functions.

<HEAD>

<SCRIPT LANGUAGE="VBScript">
<!--
Function RandomGreeting()
	Dim Greeting(5), Quote
		
	Randomize
		
	Greeting(0) = "Hello there!"
	Greeting(1) = "Welcome!"
	Greeting(2) = "Bienvenido!"
	Greeting(3) = "Hola!"
	Greeting(4) = "Enjoy your stay!"
		
	Quote = Int(Rnd() * ((5 - 1) + 1))
	RandomGreeting = Greeting(Quote)
End Function
-->
</SCRIPT>

</HEAD>

<BODY>

<SCRIPT LANGUAGE="VBScript">
<!--
document.write RandomGreeting
-->
</SCRIPT>