Page 1 of 2
Number licence xxxx-xxxx-xxxx-xxxx
Posted: Thu Feb 01, 2007 9:57 am
by Silvio
Have you and Idea or a function to create number licence as Office Microsoft Licence ?
Posted: Thu Feb 01, 2007 11:05 am
by UD previous posts
u can use 123456789 and abcdefghijklmnopqrstuvwxyz to create Office Style
Serial numbers
Posted: Thu Feb 01, 2007 11:40 am
by Silvio
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
what ????????????
Posted: Thu Feb 01, 2007 1:53 pm
by Rochinha
Amiguinho
See this
REGIDA := nSerialHD()
REGIDB := nSerialHD()
REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDB,8,1)
REGIDC := REGIDC+SUBS(REGIDA,2,1)+SUBS(REGIDB,7,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDB,6,1)
REGIDC := REGIDC+SUBS(REGIDA,4,1)+SUBS(REGIDB,5,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDB,4,1)
REGIDC := REGIDC+SUBS(REGIDA,6,1)+SUBS(REGIDB,3,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDB,2,1)
REGIDC := REGIDC+SUBS(REGIDA,8,1)+SUBS(REGIDB,1,1)
This returns a number with "XXXX-XXXX-XXXX-XXXX" format.
Or use this:
REGIDA := GerarSenha(16,2)
REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDA,2,1)
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDA,4,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDA,6,1)
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDA,8,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,9,1)+SUBS(REGIDA,10,1)
REGIDC := REGIDC+SUBS(REGIDA,11,1)+SUBS(REGIDA,12,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,13,1)+SUBS(REGIDA,14,1)
REGIDC := REGIDC+SUBS(REGIDA,15,1)+SUBS(REGIDA,16,1)
Function GerarSenha(MaxNum,Tipo)
* 1 = Somente Numeros
* 2 = Numero e Letras
* 3 = Somente Letras
local chave := ""
var_valores := { "0123456789",;
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",;
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" }[Tipo]
for i = 1 to MaxNum
num := random(len(var_valores))
chave := chave + substr(var_valores,num,1)
next
return lTrim(chave)
Posted: Thu Feb 01, 2007 2:40 pm
by Silvio
Good Mr Rochinha
BUT NOT FOUND RANDOM FUNCTION
Posted: Thu Feb 01, 2007 5:20 pm
by James Bott
Silvio,
Here is a random() function that I found somewhere.
James
/*
Here is a simple but good working random number generator for with a
period of 2^31-2. It generates uniformly distributed numbers in the
range from 0 to 1, limits included.
Clipper code donated to the Public Domain by Phil Barnett November 29, 1996
Random numbers donated to the Universe by God.
*/
static seed := 0
/*
procedure test()
local d := date()
local x
SET DECIMAL TO 16
// call it once with the seed
random( seconds() * day( d ) * month( d ) * year( d ) )
do while !lastkey() == 27
// then, call it with no parameter repeatedly
x := random()
? x
// produces random numbers in the range of 0 - 100 inclusive
?? int( x * ( 100 + 1 ) )
// produces random numbers in the range of 1 - 100 inclusive
?? int( x * 100 ) + 1
// produces random numbers in the range of 0 - 99 inclusive
?? int( x * 100 )
// inkey(.01)
enddo
return
*/
********************************************************************
function random( s )
local a := 16807 // This is just a lucky prime number
// you can hardcode these as constants for better speed
local m := ( 2 ^ 31 ) - 1
local q := int( m / a )
local r := int( m % a )
if valtype( s ) == 'N'
seed := s
endif
seed := a * ( seed % q ) - r * ( seed / q )
IF seed <= 0
seed += m
endif
return ( seed - 1 ) / ( m - 2 )
/*
Other Prime Numbers are:
38833
37171
11903
18233
31337
23339
27481
31063
34543 // an anagram prime!
36299
13691
17659
29411
If you need more, get the SIEVE.ZIP program and modify it.
*/
Posted: Thu Feb 01, 2007 5:31 pm
by Antonio Linares
Silvio,
FW provides nRandom( [nRange] )
Posted: Thu Feb 01, 2007 5:34 pm
by Silvio
thanks to all
Posted: Fri Feb 02, 2007 12:23 am
by Jeff Barnes
Hi Silvio,
I don't know if this will help you but you can look at this post....
http://fivetechsoft.com/forums/viewtop ... ht=#19497
Jeff
Posted: Fri Feb 02, 2007 11:26 am
by Maurilio Viana
Rochinha and All,
In my routine I avoid use 0 (zero) number and O (upper "o") character to avoid confuse the user...
Regards
Maurilio
Posted: Fri Feb 02, 2007 1:12 pm
by Rochinha
Yes
One question, a lot of solution, it's good.
Posted: Fri Feb 02, 2007 5:36 pm
by Silvio
JEFF
WHERE ARE THE KEYGEN SOURCES
Posted: Mon Oct 20, 2008 9:32 am
by cgomez
Como puedo crear un numero aleatorio de 6 dÃgitos
Posted: Mon Oct 20, 2008 11:19 am
by Enrico Maria Giordano
KeyGen32
Posted: Mon Oct 20, 2008 9:36 pm
by David Williams
Hi Jeff
Can you supply the download link to KeyGen32 again as it has expired?
Many thanks
David