Advertisement
nicolas42

uuid

Nov 3rd, 2012
1,128
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uuid: funct [
  2.     {Make a universally unique identifier (UUID)
  3.     Make sure you random/seed now/precise beforehand
  4.    
  5.     Make a random 25 digit alphanumeric string with 8.08281277464764E+38 alternatives. 
  6.     This is higher than a 128 bit binary which has 3.4 × 10 ** 38 alternatives.
  7.    
  8.     ;unprintable version
  9.     o: copy {} loop 16 [append o to-char random 255] ;(16 bytes)
  10.     }
  11. ][
  12.     a: "abcdefghijklmnopqrstuvwxyz0123456789"
  13.     o: copy {}
  14.     loop 25 [append o pick a random length? a]
  15. ]
  16.  
  17. binary-embedder: funct [] [
  18.     ;system/options/binary-base: 64
  19.     file: to-file request-file/only
  20.     data: read/binary file
  21.     print enbase/base data 64
  22. ]
Advertisement
RAW Paste Data Copied
Advertisement