Which of those solution does not use JS? Of course I think in 5.1.20+ it is possible to use math operators plus the now macro to create random number
Best wishes Mohammad On Tue, Sep 10, 2019 at 10:24 PM @TiddlyTweeter <tiddlytwee...@assays.tv> wrote: > See > https://groups.google.com/forum/#!searchin/tiddlywiki/random$20numbers$20josiah%7Csort:date/tiddlywiki/N263pebgCYI/bWkecUA7AwAJ > > On Tuesday, 10 September 2019 19:41:37 UTC+2, Mohammad wrote: >> >> Hi TT >> Is there any filter or math operator to do this? >> >> >> Best wishes >> Mohammad >> >> >> On Tue, Sep 10, 2019 at 9:51 PM @TiddlyTweeter <tiddly...@assays.tv> >> wrote: >> >>> One query. DO we need JavaScript for that? >>> >>> I thought it was doable in TW already? >>> >>> TT >>> >>> On Tuesday, 10 September 2019 19:11:51 UTC+2, Mohammad wrote: >>>> >>>> One question, >>>> How about the performance effects? It seems when a tiddler uses this >>>> filter every change on the screen trigger the simple filter! >>>> >>>> >>>> Best wishes >>>> Mohammad >>>> >>>> >>>> On Tue, Sep 10, 2019 at 12:35 AM Devin Weaver <weave...@gmail.com> >>>> wrote: >>>> >>>>> For anyone curious here is a neat filter option to grab a random >>>>> tiddler from a list: >>>>> >>>>> <$list filter="[tag[quote]sample[3]]"> >>>>> <$transclude/> >>>>> </$list> >>>>> >>>>> will show you three random tiddlers with the quote tag. >>>>> >>>>> /*\ >>>>> title: $:/filters/sample.js >>>>> type: application/javascript >>>>> module-type: filteroperator >>>>> >>>>> Filter to return random set from the current list. >>>>> >>>>> \*/ >>>>> (function(){ >>>>> >>>>> /*jslint node: true, browser: true */ >>>>> /*global $tw: false */ >>>>> "use strict"; >>>>> >>>>> /* >>>>> Export our filter function >>>>> */ >>>>> exports.sample = function(source,operator,options) { >>>>> var sampleIndex; >>>>> var allTitles = []; >>>>> var samples = []; >>>>> var numberOfSamples = parseInt(operator.operand) || 1; >>>>> source(function(tiddler,title) { allTitles.push(title); }); >>>>> if (numberOfSamples >= allTitles.length) { return allTitles; } >>>>> for (var i = 0; i < numberOfSamples; i++) { >>>>> sampleIndex = Math.floor(Math.random() * allTitles.length); >>>>> samples = samples.concat(allTitles.splice(sampleIndex, 1)); >>>>> } >>>>> return samples; >>>>> }; >>>>> >>>>> })(); >>>>> >>>>> >>>>> -- >>>>> 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 tiddl...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/tiddlywiki/7ad1fb46-382e-417c-a5a4-6e412274a2e8%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/tiddlywiki/7ad1fb46-382e-417c-a5a4-6e412274a2e8%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> 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 tiddl...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/tiddlywiki/21677588-663c-40ad-8292-745c5a2f0b18%40googlegroups.com >>> <https://groups.google.com/d/msgid/tiddlywiki/21677588-663c-40ad-8292-745c5a2f0b18%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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 tiddlywiki+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/1678c4fe-eb83-4ec7-8b88-087393253082%40googlegroups.com > <https://groups.google.com/d/msgid/tiddlywiki/1678c4fe-eb83-4ec7-8b88-087393253082%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAyqgrRRBRTYO%3D4hBir_4bTM-3UpqrP1%2Bn4kPzDtNVtyw%40mail.gmail.com.