Number licence xxxx-xxxx-xxxx-xxxx

User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Number licence xxxx-xxxx-xxxx-xxxx

Post by Silvio »

Have you and Idea or a function to create number licence as Office Microsoft Licence ?
Best Regards, Saludos

Falconi Silvio
UD previous posts
Posts: 42
Joined: Sat Sep 30, 2006 9:43 am

Post by UD previous posts »

u can use 123456789 and abcdefghijklmnopqrstuvwxyz to create Office Style

Serial numbers
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
what ????????????
Best Regards, Saludos

Falconi Silvio
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post 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)
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Good Mr Rochinha

BUT NOT FOUND RANDOM FUNCTION
Best Regards, Saludos

Falconi Silvio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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.

*/
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

FW provides nRandom( [nRange] )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

thanks to all
Best Regards, Saludos

Falconi Silvio
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post 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
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post 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
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

Yes

One question, a lot of solution, it's good.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

JEFF
WHERE ARE THE KEYGEN SOURCES
Best Regards, Saludos

Falconi Silvio
cgomez
Posts: 16
Joined: Mon Feb 18, 2008 6:27 pm

Post by cgomez »

Como puedo crear un numero aleatorio de 6 dígitos
User avatar
David Williams
Posts: 82
Joined: Fri Mar 03, 2006 6:26 pm
Location: Ireland

KeyGen32

Post by David Williams »

Hi Jeff

Can you supply the download link to KeyGen32 again as it has expired?

Many thanks
David
Post Reply