Re: Slow code
Re: Slow code
- Subject: Re: Slow code
- From: Takaaki Naganoya <email@hidden>
- Date: Mon, 11 Sep 2017 23:38:55 +0900
It this a serial-code generator or a simple random number generator?
I don’t know what you need.
We can make simple random number list (item = 10,000) within 0.02 seconds.
http://piyocast.com/as/archives/4353
We can use serial key generator framework
http://piyocast.com/as/archives/3797
--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/
> 2017/09/11 14:42、Brian Christmas <email@hidden>のメール:
>
> G’day scripters
>
> Is there any method of speeding up this handler, please? ATM it’s taking 17
> seconds.
>
> Regards
>
> Santa
>
> on checkthecode1()
> set (my EnteringCode) to true
> say "Please wait" without waiting until completion
> set l to ""
> set f1 to 19480822
> set f2 to 19471206
> set m to "239360062088" as text
> random number 1.0E+11 to 9.99999999999E+11 with seed
> 11111111111111 # Not real seed
> repeat with x from 1 to 10000
> set y to x as text
> set f1 to f1 + (random number from 10 to 100)
> set f2 to f2 + (random number from 10 to 100)
> set m to random number from 1.00000000001E+11 to
> 9.99999999999E+11 as text
> set temp to number_to_string(m)
> set l to l & f1 & "-" & f2 & "-" & characters 1 through
> 6 of temp & "-" & characters 7 through -1 of temp & return as text
> end repeat
> set (my PassCodes) to l
> set (my windowMainFlag) to false
> windowMainMM's orderOut:me
> windowCode's makeKeyAndOrderFront:me
> set focus of Entry1 to true
> end checkthecode1
>
> on number_to_string(this_number)
> set this_number to this_number as string
> if this_number contains "E+" then
> set x to the offset of "." in this_number
> set y to the offset of "+" in this_number
> set z to the offset of "E" in this_number
> set the decimal_adjust to characters (y - (length of
> this_number)) thru ¬
> -1 of this_number as string as number
> if x is not 0 then
> set the first_part to characters 1 thru (x - 1)
> of this_number as string
> else
> set the first_part to ""
> end if
> set the second_part to characters (x + 1) thru (z - 1)
> of this_number as string
> set the converted_number to the first_part
> repeat with i from 1 to the decimal_adjust
> try
> set the converted_number to ¬
> the converted_number &
> character i of the second_part
> on error errmsg number errnum
> set the converted_number to the
> converted_number & "0"
> end try
> end repeat
> return the converted_number
> else
> return this_number
> end if
> end number_to_string
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >Slow code (From: Brian Christmas <email@hidden>) |