Test A Random Number For Nearby Numbers

not after code, just thoughts, suppose i'm generating a random 8-digit pin number for our clients, first i'll be checking against the db to see if it already exists before assigning it. what i might do for that is getstring all of the exsiting pins at the top of the script and just keep performing an instr until i get a 0. (i dont expect to ever go above a thousand clients for this system and hopefully my initial number will be random enough that these checks are for backup/redundancy assertion anyway)

but anyway, the main problem is: i dont want to generate a random pin that is one (or maybe two) digit(s) different from another,. i.e.

11111111 is too close to 14115111 and much too close to 11111811. 11121111 is right out of the question as it can be entered as a typo, as is 11111411 because of the numpad

so i'm after thoughts on how to perform that check, i suppose if i went with the "big string of all pins that went before" check i could perform a number of regex searches on the string. i.e.

my pin is 12345678 and i dont want ony to be one digit different so i'd check the string against .2345678 1.345678 12.45678 and so on. think i just answered my own question, anyone else got any ideas? especially for the two digit case (dont want to be performing 36 regex checks do i!)

View Replies


ADVERTISEMENT

Making It Random (getting Random Numbers)

I just wanted to know whats the best way to generate 50 or say X amount of number at random without having to repeat any of the previous number...

so far I've the following:

[VBS]<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
function RandomNumber()
dim theRandom

Randomize
'RandomNumber = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

theRandom= Int((99 - (0) + 1) * Rnd + (0))

if (theRandom<10) then theRandom = "0" & theRandom

RandomNumber = theRandom
end function
%>[/VBS]

and then I've this in the body of HTML doc: Code:

View Replies View Related

Random Numbers

I have a problem creating random numbers. I basically have this

Randomize()
iRandom = Int(10 * Rnd + 1)

If I do not wait a few sec before hitting the page again it will create the same random number as generated a few seconds before.Any idea why it is like that? Another way to reprocess the "bug" is to just fit F5 few times in a row and you end up with the same number being generated. Its annoying and I need some help to "fix" it!

View Replies View Related

Random Numbers In C#

I am trying to generate a random number between 1 and 100 into a label, using c#....

View Replies View Related

Random Numbers Access

I am developing a online test application(multiple choice ques) So for that i need to shuffel the questions randomly. eg there will be 60 Questions in total. If say 50 users are connected to it, all will be having same 60 questions but its order should be different.

i am using below code to randomly generate questions numbers but the problem with this code is it is repeating the number.I want to generate non repeatable numbers. Can anyone help me out to do it.

Dim my_num,max,min
Dim i
i = 0
max=60
min=1
For i = 1 to 60
Randomize
my_num=int((max-min+1)*rnd+min)
Response.Write my_num & "<br>"
Next

View Replies View Related

Random Numbers Find

I know thats theres already a few posts about this subject but I need to create 3 random numbers of any size, I've used the following code -:

randomnumber1 = int(rnd*9)+1
randomnumber2 = int(rnd*9)+1
randomnumber3 = int(rnd*9)+1

but it always returns, 7,5 and 6..
Not very random as you can see

View Replies View Related

Random Numbers Select

I have 30 numbers. I need to select randomly 10 out of the given 30. A number must not repeat ( eg. i can't have number 10 twice ). How can i do this??

View Replies View Related

Random Numbers And Letters

I have a code to create a random string of letters. The number of them can be whatever I desire.

what i would like to do, is have it both letters and integers. how would inmodify this code to allow that ....

View Replies View Related

Generate Random Numbers Between 10 And 1,000,000

I am trying to create a random value between 10 and 1,000,000. I am using the following code but it is creating numbers between 10,000 and 999,999. How can I fix it.

<%
Highest=1000000
Lowest=10
Randomize
Val_Rand=CStr(CLng((Highest-Lowest+1)*Rnd+Lowest))
response.write(val_rand)
%>

The code never gives small numbers like 10, 15 500, 250, 257 etc.

View Replies View Related

Allocating Random Numbers

I am using DreamweaverMx to create a football website that stores players to a databse and when they join a game there is a function to randomize a number for each player and store it on a second databse and from the database using sql to link my databases together so that a players details are posted on a page of my website.

View Replies View Related

Random Numbers Based On Points

I have this situation:

each user has some amount of points, for example:

table:users
user_id --- user_name --- points
1 --- user1 --- 100
2 --- user2 --- 100
3 --- user3 --- 100
4 --- user4 --- 200
5 --- user5 --- 500
-------------------
total points: 1000

I want to generate random selection of user, according to their points respectively, so the more points he has, the more likely he will be selected:

user1 in 10% cases
user2 in 10% cases
user3 in 10% cases
user4 in 20% cases
user5 in 50% cases

this percentage is respective to their points; I put some rounded numbers in the example - so total points of 1000 equals 100% - but they can have any amount of points: 1, 200, 3672 etc.

View Replies View Related

Display And Delete Random Numbers

I’m having problems on how to randomiz numbers and delete the ones that have been displayed.

My first step is to take some numbers:

21, 32, 35, 4, 15 and randomize theese so the ouput may look something like this:
35, 21, 15, 32, 4

My second step is to display the first number (35), then when a user clicks on a link I want the second of my random number (21) to be displayed and I also want to delete the first number (35) that has been displayed. And this routine (display number, delete previous number) should continoue untill there is no more numbers. So again, I wnat to step through all my random numbers and delete the ones I have displayed.

Example: ....

View Replies View Related

Writing Array Of Random Numbers To A Database

I am trying to write an array of random numbers to a database. The array part is working fine, but when I go to update the dataabse, it inserts the last value of the array into all the fields in the database .....

Dim MyValue,sqlRandom
Dim arrayRandom(8)
for i = 1 to 8
Randomize
MyValue = Int((100 * Rnd) + 1)
arrayRandom(i) = MyValue
response.write "<p> Array Value:" & arrayRandom(i)

sqlRandom = "UPDATE CarParkDetails SET FreeSpaces = '" & arrayRandom(i) & "'"
Conn.execute(sqlRandom)

next

I can't see whats wrong!

View Replies View Related

Function To Select 3 Random Numbers Which Are Distinct

I need to generate three random numbers between 1 and 100, but they need to be different.

e.g. 3,43,88 would be fine but 5,76,76 would not.

The function I have to generate a single random number is:

function funRandomNumber(intHighestNumber)
randomize
funRandomNumber = int(rnd * intHighestNumber) + 1
end function

called by: funRandomNumber(100)
Can anyone see how this can be modified to do what I need?

View Replies View Related

Comparing A Number To A Set Of Numbers

I am facing a situation I dont know how to solve... at least with a good server response for 400.000 users.

Maybe someone may help:

We have a B2B with a list of thousands of products listed. Users can select the products they like in order to contact the seller later on from a "cart of products/contacts".
Selected products are stored in a session variable.

What I want is: How to remove the check button of each product that has already been selected, and instead of that, show something like "selected" or similar.

The problem I am facing is to compare each product ID against the session with all selected products. This comparison for every line/product could harm the response of the server with the high number of users we have. how would you do this comparison?

View Replies View Related

Random Number Not Random

I am trying to generate a random number. I am using randomize and then rnd to return a decimal number between 100 and 120. This will give me a longitude. I am doing something similar to generate a latitude.

I created this on a page which refreshs every minute. I put these points into a map and they are showing up in groups of straight lines. Since rnd is time based will refreshing every 60 seconds return similar numbers?

View Replies View Related

Random Number

trying to get a random number from 0000 to 9999, is there an easy way to do this? i'm using this for a unique filename and want it to be 4 digits from 0000 to 9999.

View Replies View Related

Random Number

x = ROUND((0.9+1.005*RND()-0.4),1)
y = INT(y * x)

This is what I'm trying to acheive:
- "Y" has a preset value between 1-100
- "X" should be random between 0.8 and 1.2
- "X * Y" is the final value of "Y" as a whole number

What I'm struggling with is getting the value of X to be random between 0.8 and 1.2....

View Replies View Related

Random Number

How would you go changing a random number generated into a item drawn from a database with SQL....

View Replies View Related

Random Number

I need to create a random number, or even better, and random combination of letters and numbers, to be used as a type of security key for changing a user's password on this site i'm working on. Basically, the user fills out this form which sends them and e-mail w/ instructions on how to change their password (pretty basic, lots of sites do it).

In the e-mail of course is a link which links to a page with querystring values that include their customer number, the action (reset password), and hopefully this "key." What I'd like to do is have the key written to a database when the e-mail is sent and then deleted when the password is changed. So, how can I generate this key. I think I can take care of the writing to/deleting from the database.

View Replies View Related

Random Number Problem

I'm trying to create a random number that has to solid letters at the beginning followed by 8 random numbers (DN13523781) This number also can't be in use alreaddy which means it can't alreaddy be in a colum called number in the database.

I can do the letters followed by one number, but I can't figure out how to get 8 numbers in a row without getting the same ones over and over(88888888)

I also don't know how to check if it's alreaddy used in the database.

Also does someone know how I can prevent the same number from being produced before it can be added to the database at an other location/pc.

I'm building an online store and I want to give people an order number when they order something. Code:

View Replies View Related

Random Number Function

Does anyone know of any parameters for either of these functions?
Say, if I wanted only numbers between 1 and 100?
Code:

<%
randomize()
response.write(rnd())
%>

View Replies View Related

Unique Random Number

How can I generate a unique random number?

View Replies View Related

0.7055475 Is Not A Random Number!

I've got a realy wierd server problem - everytime i ask for a random number using rnd() i get 0.7055475. This problem just appeared the other day. I hadnt changed any server or os settings, however i have recently recieved a 6 part xp pro update... - has anybody come accross this before?

View Replies View Related

Generate Random Number Between 1 & 5

I want to display a random banner from a selection of 5 banners. So if number = 1 then display baner 1 etc. My code is as follows:

bannerCount = bannerRecordSet.RecordCount
Dim bannerSelected
Randomize
bannerSelected = Int(Rnd * bannerCount)

The above code works although it never seems to generate the value 1, ie 2-5. Also when I refresh the page sometimes a random banner is displayed and other times I get an error. Is this because I am generating a value outside 1-5? Code:

View Replies View Related

ASP Random Number Generator?

Does anyone know how to code in a very simple random number generator?

Basically, my ASP site is linked to an SQL d/base. What I want to do is have a "Random quote of the day"... the R.N.G. should spit out a number, and that number references the random_quote_ID in the d/base and spits it out.

View Replies View Related

Assign A Random Number

I have this simple application that I put together using ASP. It has an html form that submits to an access database through a simple ASP file. It’s a survey form basically. One of the departments here wants to get some feedback from their students and in return for filling out the survey they will be entered into a drawing for a gift certificate. The catch is that the survey is anonymous. What they want to happen is each person is given a unique number at the end of the survey and they will pick one of those numbers randomly to see who the winner is. How can I possibly do this? I am stuck.

I think I may know what I need to do:

Pull a unique number from a database and post it onto the HTML form near the submit button. Notate on the page that the user write the number down and when they hit submit it is inserted into the database along with the record. I have absolutely no idea how to do that.

The HTML form submits into the database using this "add.asp" file:

Code: ....

View Replies View Related

Generating Random Number...

I've tried using javascript to rotate an image upon reload, but I can't get it working, so now I'm trying it with asp. I don't understand why this won't work. Any ideas? Code:

View Replies View Related

Random Number Generation

I want to create a random number where it concatenates with the "day counter" as explained below and name of the person inorder to generate a unique id.

by day counter i mean. there are 365 days in a year and today is the 18th day of the yeat. so the counter generated shud be 18&Smilesmita. How do i do this in ASP ?

View Replies View Related

Generate Random Number

I know this is not a php forum, but i've been given a task to create a form that requires a unique number every time the form is loaded. The form has been created but they have php on their site. windows would be in 3 weeks time but they want the form asap. The field is a hidden field since i've never looked at a php code page b4 i need some help.

View Replies View Related

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?

View Replies View Related

Simple Test Script To To Send A Test Email Using CDO

I am building a shopping cart where orders are send by email. Even though it says it's sent, I receive nothing. So I did a test script to send an email using CDO since we are using an exchange server for email and it's on the same network as the site. Code:

View Replies View Related

English Numbers Into Arabic Numbers

I'm working on asp project, access 2000 at backend.I can write arabic text and arabic
numbers in textbox and save them in database.but if i see these records, arabic text and arabic numbers,it is ok,if my computer is arabicenable.

If my computer is not arabic enable then it show arabic number into english numbers.
how can i show arabic numbers instead of english numbers if my computer is not arabic
enable.i'm working on a project i have to complete it.How can i convert english numbers that are coming from database and convert that numbers in arabic for show.

I have use

<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
I shall be very thankful to you for this purpose.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved