Ed Dyreen wrote:'
You want to spit out a random line from a set of fixed-lines or a line build up with random characters ?
And the line needs to be always a specific length or a random length ?
Code: Select all
@echo off &setlocal enableextensions enabledelayedexpansion
::
:main ()
:: (
set "$charSet=^^~`@#$&:;_/.,-+=\|][{}'?()@*<> ^!%%"^"
set "$charSet"
::
for /l %%? in (
1, 1, 4
) do (
set "$string=" &for /l %%? in (
1, 1, 64
) do (
set /a $random = !random! %% 33 &for %%? in (
!$random!
) do set "$char=!$charSet:~%%?,1!"
::
set "$string=!$string!!$char!"
)
::
set "$string[%%?]=!$string!"
set "$string[%%?]"
)
:: )
pause &endlocal &exit /b
Code: Select all
$charSet=^~`@#$&:;_/.,-+=\|][{}'?()@*<> !%"
$string[1]=[]&^&>[~`'`]|@=.*(,--|@(+/|!@}'>^~*|\%*=__./|~(;;;@>? )^|~-_?_)%
$string[2]=@ ~@!.**${..*:%,^?:=; &^@\@^$^/=&/)_->:|'<}!=)`&~?:?{&*,_)=#)#[]
$string[3]=);${#*.}!$:@^$():('/>(![`~=)==?;;{@}^!+<%[$\].=<|#}$}<}}[;,:|~]~
$string[4]=`/+_,_,{!%!!@}] !&[.~=(; : -*/@%`?&,% :.:>(~~|#$%@? *;<>\~\!>
Druk op een toets om door te gaan. . .
The matrix could be of interest to you
Thanks Ed! You Solved my riddle of the charset... now the mini program in the previous post works as expected. of course now the original RAND7.bas is not preserving spaces but i will tackle that later today. as long as the mini program worked, i can fix that issue (i think) without supervision
Note for anyone wanting to use the full keyboard set, it is all about placement, first the double caret's, then the reg chars skipping exclamation ! and percent %, then add SPACE, caret BANG, double percent %% and then double quote, caret and double quote. that opens up the full keyboard for random characters. i think i won't play with the other exotic chars as they are not standard and few programs would accept them.
so the full line is: set "s=^^~`@#$&:;_/.,-+=\|][{}'?()@*<> ^!%%"^"
now back to your solution Ed, i have a few questions.
like what does this line do? i am unfamiliar with that syntax. i get the exclamation on the outside, but after the colon, i dont know how it gets the char position from :~%%?
set "$char=!$charSet:~%%?,1!"
and this line, what is it doing? im really just not understanding the %%? part, i understand what set does and the delayed expansion as well.
set "$string[%%?]=!$string!"
and shouldn't the random 33 be actually 34 (as there are 33 special char's including the space) oops never mind my error
thanks again for all you help.
oh btw, i see this alot and was wondering if you could translate it?
Druk op een toets om door te gaan. . .