#lang racket
(require "osc-defns.rkt")
(provide (contract-out [random-osc-value (-> natural? osc-value?)]))
(define natural? exact-nonnegative-integer?)
(define (random-osc-value depth)
(cond
[(= depth 0)
((list-ref flat-value-generators (random (length flat-value-generators))))]))
(define (random-sint64)
(list 'h
(- (+ (* (random (expt 2 20)) (expt 2 44))
(* (random (expt 2 20)) (expt 2 4))
(* (random (expt 2 4)) 1))
(expt 2 32))))
(define (random-sint32)
(- (+ (* (random (expt 2 20)) (expt 2 12))
(* (random (expt 2 12)) 1))
(expt 2 16)))
(define (random-char) (list 'c (random 256)))
(define (random-float32)
(random))
(define flat-value-generators
(list
random-sint32
random-sint64
random-char))
(random-osc-value 0)
(match (random 14)
(or (int32? v) (int64? v) (osc-date? v) (float32? v) (osc-double? v) (no-nul-bytes? v) (osc-symbol? v) (blob? v) (osc-char? v) (osc-color? v) (osc-midi? v) (boolean? v) (null? v)
(osc-inf? v) ))