473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Random GUID type number or RegExp

I have used

set typ = server.createobject("Scriptlet.TypeLib")

to create a random string of 36 characters. However, is there a way to
create a random string of digits in the length I request? Perhaps a string
of 20 digits with a few asterisks thrown in for ease of typing?

for example:
4515-81301-75454-45136-1

Would this be reated with RegExp? And how?
Julian

Oct 4 '06 #1
3 3391
create multiple guid's, concatenate, and read the left 20 characters.

replace hyphens with asterisks
"stjulian" <st******@discussions.microsoft.comwrote in message news:O8*************@TK2MSFTNGP06.phx.gbl...
>I have used

set typ = server.createobject("Scriptlet.TypeLib")

to create a random string of 36 characters. However, is there a way to create a random string of digits in the length I request?
Perhaps a string of 20 digits with a few asterisks thrown in for ease of typing?

for example:
4515-81301-75454-45136-1

Would this be reated with RegExp? And how?
Julian

Oct 4 '06 #2
"Jon Paal" <Jon nospam Paal @ everywhere dot comwrote in message
news:12*************@corp.supernews.com...
create multiple guid's, concatenate, and read the left 20 characters.

replace hyphens with asterisks
When I do the following:
set typ = server.createobject("Scriptlet.TypeLib")
"typ" contains a 36 byte long string within brackets.

Thus, the OP may want:
typ = Replace(Mid(typ,2,20),"-","*")

"stjulian" <st******@discussions.microsoft.comwrote in message
news:O8*************@TK2MSFTNGP06.phx.gbl...
I have used

set typ = server.createobject("Scriptlet.TypeLib")

to create a random string of 36 characters. However, is there a way to
create a random string of digits in the length I request?
Perhaps a string of 20 digits with a few asterisks thrown in for ease of
typing?

How are asterisks easy to type; why not dashes?

Do you want 20 digits or a string 20 bytes long including the asterisks?
Oct 4 '06 #3
stjulian wrote:
...is there a way to create a random string of digits
in the length I request? Perhaps a string of 20 digits
with a few asterisks thrown in for ease of typing?
What do you mean by "digits"? Will ANY character on the keyboard do? Do you
have a bias toward numbers? Letters? Does case matter?

Your example had nothing but numbers and a dash, but you suggested that
asterisk and the letters ABCDEF would be fine (since you used GUIDs).

Here's an example that will generate an arbitrary-length string of
"typeable" characters:

function GenerateString(chars) {
for (var i=0,s=""; i<chars; i++)
s += String.fromCharCode(Math.floor(94*Math.random()+33 ))
return s
}

<%=GenerateString(20)%>
VBScript left as an exercise for the reader.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Oct 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Rob Meade | last post by:
Hi all, I need to be able to create some license keys for an application. Ideally these wouldn't be too long in length (ie, easier to remember/type in), but I would like them to be auto...
4
by: yf | last post by:
A KB article "http://support.microsoft.com/default.aspx?scid=kb;en-us;209599" tells that the maximum number of records that a table may hold if the PRIMARY key data type is set to AUTONUMBER is...
3
by: Amy | last post by:
Does anyone know if thier is anything built in the framework to generate random filenames? I have a dataset(hash table) that grows very large. After a certain point a good portion of the...
5
by: rcolby | last post by:
Evening, Wondering if someone can point me in the right direction, on how I would compare a system.guid with a system.byte. system.guid (pulled from sql server table with a data type of...
38
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I have a basic question thats been niggling me, but I never found time to look at it before. If I have an enumeration such as this Fiend Enum TravelDirection North South East
5
by: Hareth | last post by:
Is this the correct way to generate random number? Dim myRandomObject As Random myRandomObject = New Random myRandomObject.Next(1, 4)
4
by: Ricardo | last post by:
Hi wizards, I have an object , this object generate a set of 9 random numbers. When I generate for example 10 object his 9 random numbers are equals. How can I make this 9 numbers are different...
9
by: Robert Mago | last post by:
Is there a way to create a 10 characthers or less, alph-numeric string which is unique. I can't use the guid since its longer then 10 characthers. Also i cannot use a random number, since being...
8
by: Anil Gupte | last post by:
I had someone write a random number generator in C# (I am more of a VB programmer) and they came up with the following: public string GetRand(int count) { string number = ""; for (int i=0;...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.