Hi Eucaly

Here comes the random filter (to limit to n results), as attached.
>
> usage : [tag[Widgets]*random[1]*]
>

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.

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.

Then we'd add a new filter "choose" that would be used like this:

[tag[Widgets]choose{$:/info/random}]

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.

Best wishes

Jeremy




>
>
>
> Philip Coltharp:
>
>> That's something I wouldn't have thought of.  Thanks
>
>  --
> 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.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
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.

Reply via email to