16樓(rnd)??? 調用dll還會快嗎? ;;BY LUCAS (排1千個) (defun RND_LAI (/ STR) (setq STR (rtos (getvar "cputicks") 2 0)) (/ (atoi (substr STR (- (strlen STR) 3))) 10000.0) ) ;;--------------------------------------------------- (defun RNDSORT5 (LEN / A B I LST2 LST3) (repeat (setq B LEN) (setq LST2 (cons (setq B (1- B)) LST2)) ) (repeat LEN (setq I (fix (* LEN (RND_LAI))) LEN (1- LEN) A (nth I LST2) LST3 (cons A LST3) LST2 (vl-remove A LST2) ) ) LST3 ) (defun C:TT (/ N LST) (setq N 0 LST NIL ) (repeat 1000 (setq LST (cons (setq N (1+ N)) LST)) ) (setq STIME (getvar "date")) (setq LST (mapcar '(lambda (X) (nth X LST)) (RNDSORT5 (length LST)))) (setq ETIME (getvar "date")) (prompt (strcat "\n程式共耗用時間: " (rtos (* 86400.0 (- (- ETIME STIME) (fix (- ETIME STIME)))) 2 3 ) "秒\n" ) ) LST )
|