Sorceress

haiku estimating

Sep 24th, 2018
767
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DIM T(20000) AS INTEGER
  2. h = 9543
  3. U = 1462
  4.  
  5. N = 10000
  6. DO
  7.   FOR i = 0 TO N: T(i) = 0: NEXT: UM = 0
  8.   FOR i = 1 TO h
  9.     m = INT(RND * N)
  10.     IF T(m) = 0 THEN UM = UM + 1
  11.     T(m) = 1
  12.   NEXT
  13.   PRINT UM; " unique out of "; h; " haikus : N estimate = "; CINT(N)
  14.   IF ABS(UM - U) > 200 THEN a = 100 ELSE a = 10
  15.   IF ABS(UM - U) < 20 THEN a = 1
  16.   IF ABS(UM - U) < 5 THEN a = .1
  17.  
  18.   IF UM > U THEN N = N - a ELSE N = N + a
  19.   SLEEP
  20. LOOP
RAW Paste Data