Вы находитесь на странице: 1из 5

9 SearchDomino

z f
Random Documents

Robert Reese
u
c
Since there has been an influx of questions on how to make exams in Lotus Notes
o with random questions..I figured I'd post my random document selector.

i Things to note:
'total_questions' should be filled in programatically. It should reflect the
n number of documents in your doc collection or view that you are going to select
docs from.
1
2 'how_many' is the number of random documents to select

Once you have run randomizer() the outlist array will contain the document
number to use in getnthdocument.
example usage:
forall x in outlist
doc = view.getnthdocument(x)
endforall

--or--
forall x in outlist
doc = collection.getnthdocument(x)
endforall

Any questions on this scripts can be sent to me at:


redline@thereeses.net
Custom test dbs can also be developed.. for a price of course ;-)
Option Public
Dim tarray() As Integer
Dim outlist() As Integer
Dim total_questions As Integer
Sub Initialize
Call randomizer()
End Sub
Function randomizer()
Dim anum As Integer
Dim how_many As Integer
9
Dim place As Integer

' Total number of questions to choose from


SearchDomino
g
total_questions% = 50
' How many do you want?
how_many% = 10
Redim outlist(0 To (how_many%-1))
'Create number array
total_questions% = total_questions% -1
Redim tarray(0 To (total_questions%))
For x = 0 To (total_questions%)
tarray(x) = x+1
Next
'Now shuffle the numbers
For place = 0 To (how_many%-1)
anum% = Round(Rnd()*total_questions%,0)
outlist(place) = tarray(anum%)
Call reorg(anum%)
Next
End Function
Function reorg(place As Integer)
Dim x As Integer
'Remove selected and slide down rest
For x = place To (total_questions%-1)
tarray(x) = tarray(x+1)
Next
'Take one from total_questions
total_questions% = total_questions% -1
Redim Preserve tarray(0 To total_questions%)
End Function

This was last published in November 2000


9 SearchDomino
g
m Dig Deeper on Domino Resources
AL L NE W S G E T STARTE D M AN AG E P RO BL E M SO LVE
3

2 IBM to buy customer data integrator DWL

2 Get your shades: Lotus looks bright again

2 IBM's Goyal challenges Microsoft at Lotusphere

2 Lotusphere 2005 seeks to balance presents and futures

Load More

m Start the conversation


9 SearchDomino
g

Send me notifications when other members comment.

Add My Comment

-ADS BY GOOGLE

WINDOWS SERVER AS/400 DATA CENTER CONTENT MANAGEMENT

5
SearchWindowsServer

Microsoft patches two Windows zero-days in July Patch Tuesday


Microsoft fixed two Windows zero-day flaws as part of the July 2019 Patch Tuesday release, which also saw the
remediation of 75 ...

How to deal with the on-premises vs. cloud challenge


Some tools and applications aren't a good fit outside of the data center. Try these tactics to cope as more tools and
application...

About Us Meet The Editors Contact Us Privacy Policy Advertisers Business Partners Media Kit Corporate Site

Contributors Reprints Archive Site Map Answers Definitions E-Products Events

Features Guides Opinions Photo Stories Quizzes Tips Tutorials Videos

All Rights Reserved,


Copyright 1999 - 2019, TechTarget
9 SearchDomino
g

Вам также может понравиться