K-d tree: Difference between revisions

Content added Content deleted
m (→‎{{header|Racket}}: No need for random-real from srfi-27)
Line 955: Line 955:
<lang racket>
<lang racket>
#lang racket
#lang racket
(require (only-in srfi/27 random-real))


; A tree consists of a point, a left and a right subtree.
; A tree consists of a point, a left and a right subtree.
Line 1,036: Line 1,035:


(define (test k n)
(define (test k n)
(define (random!) (for/vector ([_ k]) (random-real)))
(define (random!) (for/vector ([_ k]) (random)))
(define points (for/list ([_ n]) (random!)))
(define points (for/list ([_ n]) (random!)))
(define t (kdtree 0 k points))
(define t (kdtree 0 k points))