Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[12pt,tikz,border=3mm]{standalone}
- usetikzlibrary{calc}
- usepackage{xstring}
- begin{document}
- large
- begin{tikzpicture}
- defn{5}
- defmylist{}
- pgfmathsetmacro{numbermax}{n*n}
- foreach x in {1,...,numbermax}{
- xdefmylist{mylistnoexpand{xnoexpand}}
- }
- begin{scope}
- pgfmathsetmacro{nt}{n-1}
- foreach i in {0,...,nt}
- {
- foreach j in {0,...,nt}
- { pgfmathdeclarerandomlist{mynum}{mylist}
- pgfmathrandomitem{mynum}{mynum}
- StrSubstitute{mylist}{{mynum}}{}[sublist]
- globalletmylistsublist
- pgfmathparse{0.9*rnd+0.3} pgfmathsetmacro{maum}{pgfmathresult}
- pgfmathparse{0.8*rnd} pgfmathsetmacro{mauh}{pgfmathresult}
- definecolor{mau}{rgb}{maum,mauh,0.1}
- node[color=mau] at ($ (i+0.5, j+0.5 ) $) {mynum};
- }
- }
- draw (0,0) grid (n,n);
- end{scope}
- end{tikzpicture}
- end{document}
- documentclass[12pt]{article}
- usepackage{pstricks,pst-calculate,multido}
- usepackage{auto-pst-pdf}
- definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
- begin{document}
- defn{5}
- begin{pspicture}(n,n)
- psgrid[subgriddiv=0,gridlabels=0pt]
- resetcolorseries[25]{test}
- multido{rRow=0.5+1.0}{n}{%
- multido{rCol=0.5+1.0}{n}{%
- rput(rCol,rRow){textcolor{test!!+}{pscalculate{randint(1,25)}}}
- }}
- end{pspicture}
- end{document}
- documentclass[12pt]{article}
- usepackage{pst-calculate}
- usepackage{pstricks,multido}
- definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
- newcounter{RandNo}setcounter{RandNo}{1}
- edefNumbers{pscalculate{randint(1,25)}}
- defgetNoList{%
- edefNumber{pscalculate{randint(1,25)}}% Zufallszahl
- addNumber{Number}Numbers!!}
- defaddNumber#1#2!!{edefx{noexpandaddNumberA#1;#2}x,,relax}
- defaddNumberA#1;#2,#3,#4relax{%
- ifxrelax#2relax % we found new number
- xdefNumbers{Numbers,#1}%
- stepcounter{RandNo}%
- ifnumtheRandNo>25 defnext{}% Neue Zahl?
- else defnext{getNoList}fi%
- else
- ifnum#1=#2 % no new number
- defnext{getNoList}%
- else
- ifxrelax#3relax
- defnext{addNumberA#1;,,relax}%
- else %
- defnext{addNumberA#1;#3,#4relax}%
- fi
- fi
- fi
- ifnumtheRandNo<25 next fi
- }
- defgetRandomNo#1{%
- globalcount0 = 1
- edefx{noexpandgetIndex#1;Numbers,,relax}x}
- defgetIndex#1;#2,#3,#4relax{%
- ifnumthecount0=#1
- defnext{#2}%
- else
- globaladvancecount0 by 1
- defnext{getIndex#1;#3,#4relax}%
- fi
- next
- }
- begin{document}
- defn{5}getNoList
- setcounter{RandNo}{1}
- begin{pspicture}(n,n)
- psgrid[subgriddiv=0,gridlabels=0pt]
- resetcolorseries[thenumexprn*n]{test}
- multido{rRow=0.5+1.0}{n}{%
- multido{rCol=0.5+1.0}{n}{%
- rput(rCol,rRow){textcolor{test!!+}{getRandomNo{theRandNo}}}%
- stepcounter{RandNo}%
- }}
- end{pspicture}
- end{document}
- documentclass[12pt,pstricks,border=1pt]{standalone}
- usepackage{tikz,xstring}
- usetikzlibrary{calc}
- defn{5}defmylist{}
- pgfmathsetmacro{numbermax}{n*n}
- foreach x in {1,...,numbermax}{
- xdefmylist{mylistnoexpand{xnoexpand}}
- }
- pgfmathsetmacro{nt}{n-1}
- newpsstyle{gridstyle}{griddots=0,subgriddiv=1}
- begin{document}
- large
- begin{pspicture}[showgrid](n,n)
- foreach i in {0,...,nt}
- {
- foreach j in {0,...,nt}
- { pgfmathdeclarerandomlist{mynum}{mylist}
- pgfmathrandomitem{mynum}{mynum}
- StrSubstitute{mylist}{{mynum}}{}[sublist]
- globalletmylistsublist
- pgfmathparse{0.9*rnd+0.3} pgfmathsetmacro{maum}{pgfmathresult}
- pgfmathparse{0.8*rnd} pgfmathsetmacro{mauh}{pgfmathresult}
- definecolor{mau}{rgb}{maum,mauh,0.1}
- rput(!ispace .5 add jspace .5 add){color{mau}mynum}
- }
- }
- end{pspicture}
- end{document}
- documentclass[pstricks,border=12pt,12pt]{standalone}
- pstVerb{realtime srand}
- begin{document}
- begin{pspicture}[showgrid](6,6)
- psLoop{5}{qdisk(!Rand 6 mul Rand 6 mul){!Rand 4 div}}
- end{pspicture}
- end{document}
Add Comment
Please, Sign In to add comment