Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Random Number Generator


Message #1 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Thu, 17 Oct 2002 15:20:37 -0300
Guys,

I am creating events calendar where people will be able to register the
events.  I am looking for a random Number gernerator and character generator
that will help me keep control of who is adding and deleting an event.  
Would someone have something like that they could share with me??

Thanks
Message #2 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Fri, 18 Oct 2002 09:13:28 -0300
Maybe someone has code that will randomly pick a number for a confirmation
number with out giving me duplicates??
Does anyone know of anything like this?



-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
Sent: October 17, 2002 3:21 PM
To: ASP Databases
Subject: [asp_databases] Random Number Generator

Guys,

I am creating events calendar where people will be able to register the
events.  I am looking for a random Number gernerator and character generator
that will help me keep control of who is adding and deleting an event.  
Would someone have something like that they could share with me??

Thanks

Message #3 by Colin.Montgomery@C... on Fri, 18 Oct 2002 15:13:19 +0100
Darrell - can't you just use an autonumber field?  If you need to disguise
the sequence, maybe you can do an elaborate replace function?  Like replace
all 1's with 5's etc?

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: 18 October 2002 13:13
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator


Maybe someone has code that will randomly pick a number for a confirmation
number with out giving me duplicates??
Does anyone know of anything like this?



-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
Sent: October 17, 2002 3:21 PM
To: ASP Databases
Subject: [asp_databases] Random Number Generator

Guys,

I am creating events calendar where people will be able to register the
events.  I am looking for a random Number gernerator and character generator
that will help me keep control of who is adding and deleting an event.  
Would someone have something like that they could share with me??

Thanks




*******

This message and any attachment are confidential and may be privileged or otherwise protected from disclosure.  If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system.  If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.

For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.

Message #4 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Fri, 18 Oct 2002 11:27:19 -0300
I would like something that will be able to give me numeric and alpha
combination so people will not be able guess on what numbers are being
generated.

Any idea what I mean?

-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...] 
Sent: October 18, 2002 11:13 AM
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator

Darrell - can't you just use an autonumber field?  If you need to disguise
the sequence, maybe you can do an elaborate replace function?  Like replace
all 1's with 5's etc?

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: 18 October 2002 13:13
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator


Maybe someone has code that will randomly pick a number for a confirmation
number with out giving me duplicates??
Does anyone know of anything like this?



-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
Sent: October 17, 2002 3:21 PM
To: ASP Databases
Subject: [asp_databases] Random Number Generator

Guys,

I am creating events calendar where people will be able to register the
events.  I am looking for a random Number gernerator and character generator
that will help me keep control of who is adding and deleting an event.  
Would someone have something like that they could share with me??

Thanks




*******

This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure.  If you are not the intended recipient,
please telephone or email the sender and delete this message and any
attachment from your system.  If you are not the intended recipient you must
not copy this message or attachment or disclose the contents to any other
person.

For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.


Message #5 by Colin.Montgomery@C... on Fri, 18 Oct 2002 16:05:22 +0100
I don't know of an easy way off the top of my head, but you could achieve
this similarly to what I suggested below.  I.e. use an Autonumber to ensure
uniqueness, but when displaying to the user (and you could always store it
in another field alongside the autonumbner) replace each digit with an
alpha-numeric string.

I'm sure if you do some research into encryption methods you'll find some
pretty complex and interesting techniques and algorithms that you can adapt
to your purpose.

HTH,
Col

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: 18 October 2002 15:27
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator


I would like something that will be able to give me numeric and alpha
combination so people will not be able guess on what numbers are being
generated.

Any idea what I mean?

-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...] 
Sent: October 18, 2002 11:13 AM
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator

Darrell - can't you just use an autonumber field?  If you need to disguise
the sequence, maybe you can do an elaborate replace function?  Like replace
all 1's with 5's etc?

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: 18 October 2002 13:13
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator


Maybe someone has code that will randomly pick a number for a confirmation
number with out giving me duplicates??
Does anyone know of anything like this?



-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
Sent: October 17, 2002 3:21 PM
To: ASP Databases
Subject: [asp_databases] Random Number Generator

Guys,

I am creating events calendar where people will be able to register the
events.  I am looking for a random Number gernerator and character generator
that will help me keep control of who is adding and deleting an event.  
Would someone have something like that they could share with me??

Thanks




*******

This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure.  If you are not the intended recipient,
please telephone or email the sender and delete this message and any
attachment from your system.  If you are not the intended recipient you must
not copy this message or attachment or disclose the contents to any other
person.

For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.



Message #6 by "Peter Foti (PeterF)" <PeterF@S...> on Fri, 18 Oct 2002 11:49:15 -0400
Here is some code that will generate a random number/string.  This example
is hard coded to create a string of 20 characters (numOfCharsToAppend), but
you could modify the function to accept a numeric parameter that would
define how large to make the generated string.  Hope this helps. :)

Regards,
Peter


<%
Function createRandomString()
   ' Initialize the random-number generator
   Randomize

   Dim charsToChooseFrom, resultString
   Dim count, x
   Const numOfCharsToAppend = 20


   charsToChooseFrom 
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"
   resultString = ""


   For count = 1 to numOfCharsToAppend 
      ' To produce random integers in a given range, use this formula:
      ' Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
      ' upperbound is the highest number in the range, and 
      ' lowerbound is the lowest number in the range.
      x = Int( ( Len( charsToChooseFrom ) - 1 + 1 ) * Rnd + 1 )
      resultString  = resultString  & Mid( charsToChooseFrom, x, 1 )
   Next


   createRandomString = resultString  
End Function

Response.Write createRandomString()
%>



> -----Original Message-----
> From: Colin.Montgomery@C...
> [mailto:Colin.Montgomery@C...]
> Sent: Friday, October 18, 2002 11:05 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> 
> I don't know of an easy way off the top of my head, but you 
> could achieve
> this similarly to what I suggested below.  I.e. use an 
> Autonumber to ensure
> uniqueness, but when displaying to the user (and you could 
> always store it
> in another field alongside the autonumbner) replace each digit with an
> alpha-numeric string.
> 
> I'm sure if you do some research into encryption methods 
> you'll find some
> pretty complex and interesting techniques and algorithms that 
> you can adapt
> to your purpose.
> 
> HTH,
> Col
> 
> -----Original Message-----
> From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
> Sent: 18 October 2002 15:27
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> 
> I would like something that will be able to give me numeric and alpha
> combination so people will not be able guess on what numbers are being
> generated.
> 
> Any idea what I mean?
> 
> -----Original Message-----
> From: Colin.Montgomery@C...
> [mailto:Colin.Montgomery@C...] 
> Sent: October 18, 2002 11:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> Darrell - can't you just use an autonumber field?  If you 
> need to disguise
> the sequence, maybe you can do an elaborate replace function? 
>  Like replace
> all 1's with 5's etc?
> 
> -----Original Message-----
> From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
> Sent: 18 October 2002 13:13
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> 
> Maybe someone has code that will randomly pick a number for a 
> confirmation
> number with out giving me duplicates??
> Does anyone know of anything like this?
> 
> 
> 
> -----Original Message-----
> From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
> Sent: October 17, 2002 3:21 PM
> To: ASP Databases
> Subject: [asp_databases] Random Number Generator
> 
> Guys,
> 
> I am creating events calendar where people will be able to 
> register the
> events.  I am looking for a random Number gernerator and 
> character generator
> that will help me keep control of who is adding and deleting 
> an event.  
> Would someone have something like that they could share with me??
> 
> Thanks
> 
> 
> 
> 
> *******
> 
> This message and any attachment are confidential and may be 
> privileged or
> otherwise protected from disclosure.  If you are not the 
> intended recipient,
> please telephone or email the sender and delete this message and any
> attachment from your system.  If you are not the intended 
> recipient you must
> not copy this message or attachment or disclose the contents 
> to any other
> person.
> 
> For further information about Clifford Chance please see our 
> website at
> http://www.cliffordchance.com or refer to any Clifford Chance office.
> 
> 
> 
> 
> 
Message #7 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Fri, 18 Oct 2002 16:14:47 -0300
Peter thank you, that is what I am looking for.
Cheers buddy

-----Original Message-----
From: Peter Foti (PeterF) [mailto:PeterF@S...] 
Sent: October 18, 2002 12:49 PM
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator

Here is some code that will generate a random number/string.  This example
is hard coded to create a string of 20 characters (numOfCharsToAppend), but
you could modify the function to accept a numeric parameter that would
define how large to make the generated string.  Hope this helps. :)

Regards,
Peter


<%
Function createRandomString()
   ' Initialize the random-number generator
   Randomize

   Dim charsToChooseFrom, resultString
   Dim count, x
   Const numOfCharsToAppend = 20


   charsToChooseFrom 
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"
   resultString = ""


   For count = 1 to numOfCharsToAppend 
      ' To produce random integers in a given range, use this formula:
      ' Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
      ' upperbound is the highest number in the range, and 
      ' lowerbound is the lowest number in the range.
      x = Int( ( Len( charsToChooseFrom ) - 1 + 1 ) * Rnd + 1 )
      resultString  = resultString  & Mid( charsToChooseFrom, x, 1 )
   Next


   createRandomString = resultString  
End Function

Response.Write createRandomString()
%>



> -----Original Message-----
> From: Colin.Montgomery@C...
> [mailto:Colin.Montgomery@C...]
> Sent: Friday, October 18, 2002 11:05 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> 
> I don't know of an easy way off the top of my head, but you 
> could achieve
> this similarly to what I suggested below.  I.e. use an 
> Autonumber to ensure
> uniqueness, but when displaying to the user (and you could 
> always store it
> in another field alongside the autonumbner) replace each digit with an
> alpha-numeric string.
> 
> I'm sure if you do some research into encryption methods 
> you'll find some
> pretty complex and interesting techniques and algorithms that 
> you can adapt
> to your purpose.
> 
> HTH,
> Col
> 
> -----Original Message-----
> From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
> Sent: 18 October 2002 15:27
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> 
> I would like something that will be able to give me numeric and alpha
> combination so people will not be able guess on what numbers are being
> generated.
> 
> Any idea what I mean?
> 
> -----Original Message-----
> From: Colin.Montgomery@C...
> [mailto:Colin.Montgomery@C...] 
> Sent: October 18, 2002 11:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> Darrell - can't you just use an autonumber field?  If you 
> need to disguise
> the sequence, maybe you can do an elaborate replace function? 
>  Like replace
> all 1's with 5's etc?
> 
> -----Original Message-----
> From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
> Sent: 18 October 2002 13:13
> To: ASP Databases
> Subject: [asp_databases] RE: Random Number Generator
> 
> 
> Maybe someone has code that will randomly pick a number for a 
> confirmation
> number with out giving me duplicates??
> Does anyone know of anything like this?
> 
> 
> 
> -----Original Message-----
> From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
> Sent: October 17, 2002 3:21 PM
> To: ASP Databases
> Subject: [asp_databases] Random Number Generator
> 
> Guys,
> 
> I am creating events calendar where people will be able to 
> register the
> events.  I am looking for a random Number gernerator and 
> character generator
> that will help me keep control of who is adding and deleting 
> an event.  
> Would someone have something like that they could share with me??
> 
> Thanks
> 
> 
> 
> 
> *******
> 
> This message and any attachment are confidential and may be 
> privileged or
> otherwise protected from disclosure.  If you are not the 
> intended recipient,
> please telephone or email the sender and delete this message and any
> attachment from your system.  If you are not the intended 
> recipient you must
> not copy this message or attachment or disclose the contents 
> to any other
> person.
> 
> For further information about Clifford Chance please see our 
> website at
> http://www.cliffordchance.com or refer to any Clifford Chance office.
> 
> 
> 
> 
> 

Message #8 by "Ken Schaefer" <ken@a...> on Mon, 21 Oct 2002 16:11:08 +1000
What database are you using?

SQL Server has the NewID() function.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...>
Subject: [asp_databases] RE: Random Number Generator


: Maybe someone has code that will randomly pick a number for a confirmation
: number with out giving me duplicates??
: Does anyone know of anything like this?
:
:
:
: -----Original Message-----
: From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
: Sent: October 17, 2002 3:21 PM
: To: ASP Databases
: Subject: [asp_databases] Random Number Generator
:
: Guys,
:
: I am creating events calendar where people will be able to register the
: events.  I am looking for a random Number gernerator and character
generator
: that will help me keep control of who is adding and deleting an event.
: Would someone have something like that they could share with me??
:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #9 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Mon, 21 Oct 2002 11:23:27 -0300
Nope, I am using an Access DB

-----Original Message-----
From: Ken Schaefer [mailto:ken@a...] 
Sent: October 21, 2002 3:11 AM
To: ASP Databases
Subject: [asp_databases] RE: Random Number Generator

What database are you using?

SQL Server has the NewID() function.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...>
Subject: [asp_databases] RE: Random Number Generator


: Maybe someone has code that will randomly pick a number for a confirmation
: number with out giving me duplicates??
: Does anyone know of anything like this?
:
:
:
: -----Original Message-----
: From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
: Sent: October 17, 2002 3:21 PM
: To: ASP Databases
: Subject: [asp_databases] Random Number Generator
:
: Guys,
:
: I am creating events calendar where people will be able to register the
: events.  I am looking for a random Number gernerator and character
generator
: that will help me keep control of who is adding and deleting an event.
: Would someone have something like that they could share with me??
:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



  Return to Index