Re: [racket-users] Creating a list of random things

2016-10-26 Thread Gustavo Massaccesi
An additional example, I hope it's useful. I think it's easy to explain if we replace (random) with a new function (get-counter!) that instead of generating a random number, it provides an increasing sequence. #lang racket (define secret-counter 0) (define (get-counter!)

Re: [racket-users] Creating a list of random things

2016-10-25 Thread Ben Greenman
Or: (build-list n (lambda (dont-care) (make-random-string))) On Tue, Oct 25, 2016 at 10:42 PM, Robby Findler wrote: > I would probably write that function like this: > > #lang racket > > (provide > (contract-out > [make-a-string (-> non-empty-string?

Re: [racket-users] Creating a list of random things

2016-10-25 Thread Robby Findler
I would probably write that function like this: #lang racket (provide (contract-out [make-a-string (-> non-empty-string? string?)])) (define (make-a-string candidates) (apply string (for/list ([i (in-range (random 100))]) (string-ref candidates (random (string-length

[racket-users] Creating a list of random things

2016-10-25 Thread Meino . Cramer
Hi, I want to create a list of random strings. For that I have created a function, which returns a string of random length and random contents. Then I used make-list n (make-random-string) to create that listand get back a list filled with n identical strings. h... make-list