Random number list help with AppleScript's text item delimiters

Made this as a coding exercise to create a list of random numbers with a random number of digits in each number:

display dialog "digits" default answer ""
set digitsnumber to text returned of result

display dialog "places" default answer ""
set placesnumber to text returned of result

set digitsarray to {}

set AppleScript's text item delimiters to "-"

repeat digitsnumber times

	set randomtext to random number from 1 to (count every text item of placesnumber)
	set placesnumber2 to 1 / (10 ^ (text item randomtext of placesnumber))
	set end of digitsarray to " " & ((random number) div placesnumber2)
end repeat

display dialog digitsarray as text

I have it set so when you put in something such as “1-2-3” for places, it will turn out random numbers with 1, 2, or 3 places. The problem is that it outputs things such as “706- 34- 273- 8”. The last item doesn’t have a dash after it, but the rest do. I think it is an issue dealing with AppleScript’s text item delimiters, since I set that to “-” and that is the separator for numbers when I input the number of places I want. Why do they show up? I just want a plain list of numbers such as “706 34 173 8”. Please feel free to point out other things I could do to make this better, as I said this is just a coding exercise (I’m not very experienced with AS, or any language for that matter.) Thanks

EDIT: I also don’t want to just change the “-” to " " (space)
EDIT 2: Nevermind, figured out I have to change the delimiters back to “”

When you convert the digits array to text, AppleScript uses the current value of the delimiter which is “-”. Just before the display dialog statement you should set them back to “”.