Random numbers

One of my uses of GS-Base is as a generator for mailmerge data that includes a generated password that’s supposed to be memorable and not guessable.

I do this by having a source table with a number of stored words in two columns and a function that selects a random word from each column and glues them together.

As far as it goes, it works fine.

But it seems to generate the same passwords on reuse. I think what I’m missing is a randomize function to ensure that the random number generator itself starts at a random point in the list of possibilities – in the old days when I used to write little programs myself, I’d have a function like randomize(time) somewhere at the top of the program.

I can’t find a similar function in GS-Base. Am I looking in the wrong place? Or thinking about the problem the wrong way?

(In case it helps, the function I use to do this in one of the databases I use this approach in is:



As always, thanks for any help you can give me and I hope everyone’s well!

As a matter of fact, for the randBetween function, the random generator seeds are initialized with a constant value every time the program is started.

The workaround would be simply to perform updating one more time (e.g. to press F9 one more time). The random series will continue with subsequent values.
You can also set/restart the generator seeds with the two other mtxRand/2 functions or just use mtxRand instead, though for this particular usage it won’t be that convenient.

Well, aside from the possibility of recreating the same random series automatically it’s obviously more problematic than not, so in GS-Base 17.4 the randBetween and rand functions are initiated automatically after starting the program.

You can try out GS-Base 17.4 and the “Insert Random Series” command where you can simply specify a list of text strings that will be picked up and inserted randomly. In this case you will only need to do the concatenation.

That’s great - thank you so much!