Print Page | Close Window

Randomizer Question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1723
Printed Date: 28 March 2026 at 11:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Randomizer Question
Posted By: pmormr
Subject: Randomizer Question
Date Posted: 09 April 2003 at 4:31pm

I'm writing a program to choose a random record from several databases and place the random records into a database.

I'm not too sure how to generate a random record from a recordset. Should I use the following code (provided that RS is my recordset object). Note: this is untested so if there are any errors don't worry about it.

<%
rs.movefirst
RANDOMIZE
Dim random
random = (rnd(1)) * 123456
random = Round(random)

While random > 0
  rs.movenext
  random = random - 1
Wend
%>

If i'm correct this code should place the record pointer on a pseudo random record.

Thanks,

  
     
     



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net