(Случайно) в Common Lisp Not So Random?

Хорошо, последний вопрос, и я закончу игру по угадыванию чисел на Common Lisp! : D Каждый раз, когда начинается игра (или начинается новая игра после первой), вызывается следующая функция.

;;; Play the game
(defun play ()
    ;; If it's their first time playing this session,
    ;; make sure to greet the user.
    (unless (> *number-of-guesses* 0)
        (welcome-user))
    ;; Reset their remaining guesses
    (setq *number-of-guesses* 0)
    ;; Set the target value
    (setq *target*
        ;; Random can return float values,
        ;; so we must round the result to get
        ;; an integer value.
        (round
            ;; Add one to the result, because
            ;; (random 100) yields a number between
            ;; 0 and 99, whereas we want a number
            ;; from 1 to 100 inclusive.
            (+ (random 100) 1)))
    (if (eql (prompt-for-guess) t)
        (play)
        (quit)))

Итак, предположительно, каждый раз, когда игрок запускает игру, должно быть установлено * target * на новое случайное целое число от 1 до 100. Однако каждый раз * target * по умолчанию равно 82. Как заставить (случайный) действовать ... случайным образом?

14
задан Andy 27 October 2010 в 13:57
поделиться