Is it possible to generate random numbers by a weighted probability distribution

I am a new user and I am leaerning Knime.

I would like to ask if it is possible to generate random numbers by a weighted probality distribution

Range 0-3
100 items
%50–> 0

I generated a little workflow that does the trick. The workflow depends upon looping through each of the 100 items and generating a random number within each range. Looping can be a little slow (particularly if there are thousands of items) so hopefully somebody else can think of a more efficient way. But this will get you started.

Generate Random Numbers by Weighted Probability 001.knwf (15.5 KB)


Thank you for you effort.

Excel calculates weighted random numbers quickly for 5000 items.

Can importing data from excel a valid method for scientific studies ?

Hi @rafetirmak

Did you consider using the Random Number Assigner as in the image below you can configure for each categorical string one distribution?

If you want to know it in more detail, you can find a summary paper about this work here : The new Iris Data - Modular Data Generators

Cheers, Iris

1 Like

Thanks Iris - a very helpful document!

I did see the Random Number Assigner but couldn’t understand the documentation. Nor could I get it to do anything that made sense. It seems like you have to link your upstream table, then run the Random Number Assigner, then get an error while the Random Number Assigner loads in the row-data, then adjust the Min-Max ranges, then run the node a second time. The error completely threw me - I thought I was doing something terribly wrong. Why not put the Min / Max fields in the upstream table? Seems like that would give you more flexibility.

1 Like

Dear Iris

Thank you for your suggessions. What I am looking is very simillar to " Multimodal age distribution: workflow and resulting distribution" in the documentation.

Thank you

It works
Thank You


@Iris I was taking closer look at the The new Iris Data - Modular Data Generators PDF that you shared and it points to an old KNIME Data Generation page: Unfortunately that link seems to be broken now that you’ve moved to Was that a useful link? Is there a new Data Generation page?


The Link does not contain more information than the paper. It is now here: