Search
Thursday, 28th of February 2019, 8:30:48 UTC
12:19:08
Lord_of_Life_
** NICK Lord_of_Life
14:39:12
mason
with a slash in front of it
14:59:49
jackdaniel
interesting read about formally-specified user interfaces: https://www.hillelwayne.com/post/formally-specifying-uis/
16:23:20
beach
jackdaniel: Interesting link.
16:38:32
_death
using statecharts for this is an interesting idea.. some months ago I started on a code generator in lisp to generate C++ code from statecharts.. I modeled a small application I wrote with it, but in the end I had other things to do ;) so the project is on hold.. the verification stuff, I don't care for
16:43:07
_death
this was the link I saw back then https://statecharts.github.io/
16:51:26
jackdaniel
oh, I thought I've posted it on #clim (I wouldn't post it here because it is not really related to lisp as such)
20:22:37
macbug
i tried to ask a question in #clnoobs but no answe, is it ok if i post eustion here?
20:22:53
macbug
sorry for the misspellings
20:23:55
macbug
hi, i'm trying to code a function with generates a random number, this random number should be between two given numbers.
20:24:02
macbug
(defun calculate-random-number (start end)
20:24:07
macbug
(let ((random-number (+ start (RANDOM end))))))
20:25:11
Xach
macbug: if start and end are 10 and 20, what is the range? the range is what you want to give to random.
20:25:30
Xach
you are on the right track with the (+ start ...) bit.
20:26:00
shka_
think about borderline cases
20:26:22
macbug
i have tried to give end the value of 100 and start a value of 1. The problem is that it always returns 45 or 93.
20:26:59
Xach
macbug: how do you test it?
20:27:21
pjb
macbug: now newbies go to #clschool, because some people thought #clnoobs was demeaning to newbies.
20:27:37
macbug
i compile the function in emacs + slime and run the function in the REPL
20:27:45
pjb
(+ start (random (- end start)))
20:27:46
sjl
(it actually switched because no one had ops to prevent the recent wave of spam)
20:28:16
Xach
macbug: and it always returns 45 or 93?
20:28:35
pjb
macbug: in the same lisp image, the pseudo-random number generator will generate other values.
20:28:54
pjb
But if you reboot the lisp image each time, then you would need to re-seed the PRNG!
20:29:16
pjb
(setf *random-state* (make-random-state t))
20:29:51
sjl
what happens when you run (loop :repeat 20 :collect (calculate-random-number 1 100)) ?
20:29:56
macbug
pjb: i tried that to, added it to the top of the source, re-compiled but no.
Thursday, 28th of February 2019, 20:30:48 UTC