PasteRack.org
Paste # 81222
2018-03-12 20:39:29

Fork as a new paste.

Paste viewed 38 times.


Embed:

Recursive random Nucleotide Generator

  1. #lang racket
  2.  
  3. (define (num->nuc num)
  4.   (cond [(= 0 num) '(A)]
  5.         [(= 1 num) '(T)]
  6.         [(= 2 num) '(C)]
  7.         [else '(G)]))
  8.  
  9.  
  10. (define (create-seq num)
  11.   (let ((x (num->nuc (random 4))))
  12.     (if (zero? num) x
  13.         (append (create-seq (- num 1))))))

=>