In Oracle the equation:
   select trunc(DBMS_RANDOM.value(0,1000)) from dual
gives you a random number of 1 - 999.

If you are looping a table, the entries in the top of the
table have a slightly better chance of getting picked than
those on the bottom.  Eg, if you find enuf entries before you
get to the bottom, those on the bottom don't have any chance.
 If you get to the bottom and start over those at the top get
two chances, but those at the bottom only get one, etc.

Depending on how important this is, you could use your random
process to go thru and give each entry a random sort number, 
then sort your table by this number, and select however many
you want from the top.

Dwayne Martin
James Madison University

---- Original message ----
>Date: Mon, 14 Aug 2006 11:49:45 -0400
>From: Carey Matthew Black <[EMAIL PROTECTED]>  
>Subject: Re: How to random get 100 entries form a table list.  
>To: [email protected]
>
>Ok. That is helpful.
>
>The user has on their screen a table field with N rows in it.
And you
>want a way to "select" (randomly) some sub set of those rows.
>
>
>First a discussion about random selection  definition then
later a
>"how" to do this in the ARS clients.
>
>Randomly could be used as follows:
>
>When the user specifies the "number" they want to audit, you
could use
>the last digit of the "seconds" to be a "random seed" to the
selection
>process. Let us call that number "now_single_second". Keep
that in a
>temp field.
>
>Then loop over the table and grab the records that have a
modified
>date that ends in that same digit until you reach the
"number" they
>wanted.
>
>If you finish that pass through the table and still do not
have enough
>records, then loop through the table and grab every record
that is the
>"now_single_second" record in the table.
>
>If you finish that pass through the table and still do not
have enough
>records, then reset "now_single_second" (or just add/subtract
one to
>the existing value) and loop through the table and grab every
record
>that is the "now_single_second" record in the table.
>
>
>
>How to do it in the clients.
>
>Add a column to the table field that uses a "Display only
field" from
>the local form. When looping through the table and you
"select" a row
>set this columns value to "X". You can then use the COLCOUNT()
>function to count the rows that are selected throughout the
process.
>
>
>Once you have all the rows marked in the display only field
then those
>rows can be later selected by using the "ROWCHANGED" keyword
when you
>walk the table again to do whatever the system/user needs to
do for
>those records.
>
>I hope that gives you some ideas...
>
>Just note that if the table field is refreshed that these "X"
values
>will be cleared, so do not do that. :)
>
>
>-- 
>Carey Matthew Black
>Remedy Skilled Professional (RSP)
>ARS = Action Request System(Remedy)
>
>Solution = People + Process + Tools
>Fast, Accurate, Cheap.... Pick two.
>Never ascribe to malice, that which can be explained by
incompetence.
>
>
>
>On 8/14/06, 李坤 <[EMAIL PROTECTED]> wrote:
>>
>>
>>      Thank you,carey
>>
>>      I am designing a Configuration Management program
now.The customer want
>> to implement a audit function as follows.
>>      First,The User search the CI from CMDB through some
search conditiones.
>>      The second, he set the number of the CI that he want
to audit,then the
>> system random get those form  searching rusult of the first
step.
>>      The problem that  I have no idea  to implement the
random getting.
>>
>>
>>
>>
>> [EMAIL PROTECTED]
>> 2006-08-14
>>
>>
>> ----- Original Message -----
>> From: Carey Matthew Black
>> To: arslist
>> Sent: 2006-08-14, 22:26:48
>> Subject: Re: How to random get 100 entries form a table list.
>>
>>
>>
>>
>>
>> I have no exact suggestion for the stated question.
>>
>> However, if you can describe what your going to use 100
random records
>> for then I might be able to provide some idea.
>>
>> Most processes that require "random" input are for things like
>> Customer Satisfaction Surveys and other "data analysis" type
>> processes. And how you approach such functions are
generally related
>> to why your doing what your doing.
>>
>> Not to mention that "random" actually means different
things depending
>> on what your doing too. (Random strings for password
generation, PKI
>> key generation and Customer Satisfaction Surveys all have
various
>> degrees of "randomness" that is needed.)
>>
>> --
>> Carey Matthew Black
>> Remedy Skilled Professional (RSP)
>> ARS = Action Request System(Remedy)
>>
>> Solution = People + Process + Tools
>> Fast, Accurate, Cheap.... Pick two.
>> Never ascribe to malice, that which can be explained by
incompetence.
>>
>>
>> On 8/14/06, 李坤 <[EMAIL PROTECTED]> wrote:
>> >
>> >
>> > ARSLISTDear Listers,
>> >
>> > I am sorry to trouble you,there is some question with my
work.
>> > How to random get 100 entry form a table list.
>> >
>> > Thanks a lot !
>> >
>> >
>> >
>> > [EMAIL PROTECTED]
>>

Dwayne Martin
Computing Support
James Madison University

Reply via email to