I want to create a javascript that is able to randomly generate a 7 digit number and fill it in a textbox that is unchangeable. It should not repeat the same number before all of the possible numbers has already been used.
Can someone please help??
9 1318
Unless you store all previous numbers, this won't be possible.
Use Math.random() for the randomization. Note that it gives a number between 0 and 1. To get a useful number between 1 and something, use something like Math.floor(Math.random()*maxNum+1).
Unless you store all previous numbers, this won't be possible.
Use Math.random() for the randomization. Note that it gives a number between 0 and 1. To get a useful number between 1 and something, use something like Math.floor(Math.random()*maxNum+1).
How would I store the previous numbers that it can't be used again in the next 30 days. With the "Math.floor(Math.random()*maxNum+1)" I supose I can get it right.
Thank you for your help
gits 5,390
Expert Mod 4TB
hi ...
in case you store it in a database you could retrieve all the used numbers on pageload and build a lookup list with it ... another way would be a cookie at the clientside ... but i would prefer the db-way :)
kind regards
hi ...
in case you store it in a database you could retrieve all the used numbers on pageload and build a lookup list with it ... another way would be a cookie at the clientside ... but i would prefer the db-way :)
kind regards
How do I create a database that the client browser can add the number automaticly. (I have very little experience in javascript as you might have noticed).
Thanx for the help
How do I create a database that the client browser can add the number automaticly.
A database would require server-side coding. Which language are you using on the server-side?
A database would require server-side coding. Which language are you using on the server-side?
I can't yet use any serverside code, but would try to do something about that (I am the same person of the "Bookings manager" and this client have selected the Micro option too, like every body else).
I should have a reply about tomorrow (18 January 2008) about server side code.
I can't yet use any serverside code, but would try to do something about that (I am the same person of the "Bookings manager" and this client have selected the Micro option too, like every body else).
Yes, I noticed. You'll have to try to convince them. If they don't agree, you can use cookies, but that would only be random for that one person (not across al people using the system) and I think cookies have a size limit.
Yes, I noticed. You'll have to try to convince them. If they don't agree, you can use cookies, but that would only be random for that one person (not across al people using the system) and I think cookies have a size limit.
Well, thanx for the help, even as I was not successful with this.
Well, thanx for the help, even as I was not successful with this.
You weren't successful in convincing them that they needed server-side code? Sometimes clients need to know that things are simply not possible the way they see it. This can only be done on the server-side. JavaScript is great at what it does, but it's limited (for a reason).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Brandon Michael Moore |
last post by:
I'm trying to test a web application using a tool written in python. I
would like to be able to generate random values to put in fields. I would
like to be able to generate random dates (in a...
|
by: Thomas Mlynarczyk |
last post by:
I remember there is a programming language where you can initialize the
random number generator, so that it can - if you want - give you the exactly
same sequence of random numbers every time you...
|
by: Jack |
last post by:
I have two files:
sort_comparison.c++
my_sort.h
sort_comparison.c++ calls this code in my_sort.h:
void my_sort::fillArray(int arr,int n)
{
// const int random_number_range=1000000;
|
by: Johnny Snead |
last post by:
Hey guys,
Need help with this random sort algorithm
private void cmdQuestion_Click(object sender, System.EventArgs e)
{
Random rnd = new Random(); //initialize rnd to new random object...
|
by: Leon |
last post by:
I need a program that generate 5 non-duplicates random number between 1-10
as string values store in an array.
Do anybody know of any good books or websites that explain how to generator
random...
|
by: Papajo |
last post by:
Hi, This script will write a random number into a document write tag,
I've been trying to get it to write into a input form box outside the
javascript, any help is appreciated. Thanks Joe
...
|
by: Pascal |
last post by:
hello and soory for my english
here is the query :"how to split a string in a random way"
I try my first shot in vb 2005 express and would like to split a number in
several pieces in a random way...
|
by: Chelong |
last post by:
Hi All
I am using the srand function generate random numbers.Here is the
problem.
for example:
#include<iostream>
#include <time.h>
int main()
{
|
by: bilgekhan |
last post by:
What is the correct method for generating 2 independent random numbers?
They will be compared whether they are equal.
What about this method:
srand(time(0));
int r1 = rand();
srand(rand());...
|
by: Nick |
last post by:
Hi there,
I'm trying to create a random number via a seed in VB.NET and C++, 2
different applications. I want to be able to use the same seed and get the
same random number but unfortunately...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
| |