The Doughnut Shop™

Python, 263 bytes

So I saw a challenge with no answers that looked relatively easy but also interesting and thought to myself:

Hmm... If I'm the only one with an answer, I'll be winning until a better answer inevitably shows up.

So I sat down with Python for a few minutes and came up with a rough draft which, with the help of the community's suggestions, I have been tweaking to reduce its size.

from random import*
def D(O,I,S,P):
 a=range(-O,O+1);C=lambda x,y,z,n:(n-.5)**2<x*x+y*y<(z+.5)**2
 if I>=O:I=0
 for y in a:
  R=''
  for x in a:
   if C(x,y,O,O)+(C(x,y,I,I)&(I!=0)):R+='#'
   elif C(x,y,O,I)&(uniform(0,1)<P):R+=choice(s)
   else:R+=' '
  print(R)

For the examples above, this creates

>>> D(10, 4, "^+*-", 0.1)
       #######       
     ##       ##     
    #         * #    
   #             #   
  #          + ^  #  
 # +               # 
 #   + +#####   -  # 
#      ##   ##    ^ #
#     ##     ##  *  #
#-    #       #     #
#     #       #  +  #
# +   #       #     #
#     ##     ##     #
#      ##   ##  *   #
 #+-    #####      # 
 #             - - # 
  #   -    -     +#  
   #      ^      #   
    # -    +    #    
     ## *     ##     
       #######       
>>> 

and

>>> D(5, 2, ":^+*", 0.9)
   #####   
  #*^:* #  
 #^::*:^*# 
#* :###+*:#
#:*#   #+:#
#::#   #+ #
#+:#   #*:#
#^^:###::^#
 # + :*^ # 
  # *:+*#  
   #####   
>>> 

I highly doubt that this is the shortest possible solution, but I think it worked out pretty well for a self-taught teenager's attempt to kill time. Since this was designed to be as small as possible, I have not included comments and have taken shortcuts on every variable name and as such, this program is more for usability than readability.

Should you want to use this code for some reason unbeknownst to me, just run it in IDLE and type the command

D(Outer Radius, Inner Radius, Sprinkles, Chance of Sprinkle)

in the format described above.


MATLAB, 231 bytes

Here a matlab solution:

function g=z(r,q,s,p);[x,y]=meshgrid(1:2*r,1:2*r);d=(x-r).^2+(y-r).^2;h=size(d);e=zeros(h);e(d<r^2 & d>=q^2)=1;f=bwperim(e,4);k=rand(h);j=numel(s);l=changem(randi(j,h),s,1:j);g=char(e);g(:,:)=' ';g(k<=p)=l(k<=p);g(f)='#';g(~e)=' ';

Some examples:

>> z(10, 4, '^+*-', 0.1)

ans =

     #########      
    #         #     
  ##           ##   
  #    -       -#   
 #               #  
#   -  #####    ^ # 
#     #     #     # 
#   -#       #    # 
# *  #       #+   # 
#**  #       #    # 
#  * #       # -  # 
#+  *#       #    # 
#     #     #     # 
#      #####      # 
 #           ^   #  
  #     *       #   
  ##+          ##   
    #         #     
     #########      

>> z(5, 2, ':^+*', 0.9)

ans =

  #####   
 #++::*#  
#^^###++# 
# #   #+# 
#^#   #^# 
#*#   #*# 
#+:###^*# 
 #*:^+^#  
  #####   

>> z(20,6, 'erthhjjjjkjkk', 0.4)

ans =

             #############              
           ##jh  k  k  k  ##            
         ##  jjj    j khh   ##          
        #r kj h   k tjhj j    #         
      ##jk    t k  jh j       h##       
     #k       rre            k j #      
    # j   j j  j  khtkt jr     kj #     
    #  k   rk je    j      h   j  #     
   # j   k   k  jth e k j   j    j #    
  #h   h h e     t e ej  j  r k r e #   
  #    j   r  jh  jk     j  kk   j  #   
 #      k     k    h k  jk     k j   #  
 #  jjk   hh k hj  r  j  je rjj k j  #  
#  ek  j j jj  h#######          hke  # 
#hj      k j j #       #ke jhkt  jee  # 
#        jk  k#         # k    j   t  # 
#k        j  #           #khk  r     j# 
#   tj  j te #           # j  r j j   # 
#e   je   jhk#           #        t j # 
#jj    j  h  #           #     k jj e # 
# j j   hj j #           # jkt kjjjr e# 
#j k    e    #           #       r   k# 
#jj  k    ek #           # hj  j rtj  # 
#   k j   hk h#         #     j  h j  # 
#   h trt  jrht#       #   et        k# 
#j  ehjj      j #######ett  kh kjj k  # 
 #   r  jj    ekk jk    th k   kkk h #  
 #hj       khe kj hr  jj   kk  r j   #  
  #r t    k j  k r  j  jk k hh    jj#   
  #  kjj  h k j       j rrr j  r j  #   
   #j kej  jj    t       h  j   hh #    
    #  he   e  tje j  tjhkjk kj   #     
    #j kt rjk    j j  ee    rkj   #     
     #   jjr e  j jkt j   e  j  j#      
      ##k  thhjj je   kj  kh   ##       
        # hje  j     jj kk t j#         
         ## k       h     e ##          
           ## e jje   kkhj##            
             #############