>
> There is a potential issue with this approach. It means that each time the
> filter is evaluated it might return different results, even if the tiddler
> store hasn't changed. This is contrary to the expectations of the rest of
> the system; it means, for example, that content could change unexpectedly
> whenever there is a refresh cycle. In many situations this might not
> matter, of course.
>
First of all, I think there are usecases where a new random set at each
refresh is actually desired. Where that is not the case, does the DOM get
entirely replaced or are states preserved upon refresh?
A better approach would be to generate a random number and store it in a
> tiddler, and then use that tiddler value to choose a tiddler to display.
> That would mean that the entire state of the UI is once more represented by
> the tiddler store.
>
So, in outline, we introduce a tiddler '$:/info/random' that is initialised
> with a random number at startup. We'd also add a "tm-generate-random"
> message so that the random value could be regenerated by the user after
> startup.
>
Doesn't there have to be one random number per filter expression requesting
it rather than one global random number for all filters to make use of?
> Then we'd add a new filter "choose" that would be used like this:
> [tag[Widgets]choose{$:/info/random}]
>
That I really don't get. What is important is that each instance of a
*[random[]]* filter or a filter making use of a random number needs to
persist the initial draw until a page reload.
The action of the 'choose' filter would be to modulo the operand by the
> number of entries in the current list, and then use the result as an index
> to choose a value from the current list.
>
As Stephan pointed out, modulo will impinge on randomness.
Best wishes, Tobias.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.