| … | … | @@ -22,15 +22,13 @@ |
| 22 | 22 | (fluid-set! rand-state-fluid |
| 23 | 23 | (seed->random-state (get-internal-real-time)))) |
| 24 | 24 | |
| 25 | | ; XXX FIXME -- this is a stunningly slow and sloppy random-string |
| 26 | | ; generator. But whatever. I don't have the hours in the day to fix |
| 27 | | ; everything. |
| 28 | | (while (> str-length 0) |
| 29 | | (set! str (string-append str (string (string-ref alphanumeric |
| 30 | | (random alphlen (fluid-ref rand-state-fluid)))))) |
| 31 | | (set! str-length (- str-length 1)) |
| 32 | | ) |
| 33 | | str |
| 25 | ; Build random part by collecting chars into a list |
| 26 | (define rs (fluid-ref rand-state-fluid)) |
| 27 | (let loop ((n str-length) (chars '())) |
| 28 | (if (zero? n) |
| 29 | (string-append str (list->string chars)) |
| 30 | (loop (- n 1) |
| 31 | (cons (string-ref alphanumeric (random alphlen rs)) chars)))) |
| 34 | 32 | ) |
| 35 | 33 | |
| 36 | 34 | (define-public (random-node-name node-type random-length prefix) |