<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to generate random numbers between 1-20 in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1816328#M66809</link>
    <description>&lt;P&gt;Thanks a lot.. it worked.&lt;/P&gt;</description>
    <pubDate>Sun, 20 Jun 2021 04:19:32 GMT</pubDate>
    <dc:creator>techvarun</dc:creator>
    <dc:date>2021-06-20T04:19:32Z</dc:date>
    <item>
      <title>How to generate random numbers between 1-20</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1815816#M66761</link>
      <description>&lt;P&gt;I want to generate 20 random numbers to be distributed within 100%.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the below script but it is creating some duplicates. Please&amp;nbsp; advice on getting the unique 20 records&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table:&lt;BR /&gt;LOAD&lt;BR /&gt;ROUND(rand()*20,1)AS User_Number,&lt;BR /&gt;'10' AS Percentage&lt;BR /&gt;AutoGenerate 2;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Concatenate(Table)&lt;BR /&gt;LOAD&lt;BR /&gt;ROUND(rand()*20,1)AS User_Number,&lt;BR /&gt;'15' AS Percentage&lt;/P&gt;&lt;P&gt;AutoGenerate 3;&lt;BR /&gt;Concatenate(Table)&lt;BR /&gt;LOAD&lt;BR /&gt;ROUND(rand()*20,1)AS User_Number,&lt;BR /&gt;'20' AS Percentage&lt;BR /&gt;AutoGenerate 4;&lt;/P&gt;&lt;P&gt;Concatenate(Table)&lt;BR /&gt;LOAD&lt;BR /&gt;ROUND(rand()*20,1)AS User_Number,&lt;BR /&gt;'25' AS Percentage&lt;BR /&gt;AutoGenerate 5;&lt;/P&gt;&lt;P&gt;Concatenate(Table)&lt;BR /&gt;LOAD&lt;BR /&gt;ROUND(rand()*20,1)AS User_Number,&lt;BR /&gt;'30' AS Percentage&lt;BR /&gt;AutoGenerate 6;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Varun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 18:17:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1815816#M66761</guid>
      <dc:creator>techvarun</dc:creator>
      <dc:date>2021-11-30T18:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate random numbers between 1-20</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1816259#M66797</link>
      <description>&lt;P&gt;Hi, you can create a table with enough records to ensure it has all numbers, and from this table load the ones that are different.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rand:
LOAD
ROUND((rand()*19)+1,1) as value
Autogenerate 2000;

UserCodes:
LOAD value as UserCode,
	RowNo() as RowNumber
resident rand
Where not exists('UserCode',value);
DROP Table rand;&lt;/LI-CODE&gt;&lt;P&gt;Then you can use the Lookup() function to assing the values of this table:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table:
LOAD
Lookup('UserCode', 'RowNumber', RowNo(), 'UserCodes') as User_Number,
'10' AS Percentage
AutoGenerate 2;

Concatenate(Table)
LOAD
Lookup('UserCode', 'RowNumber', RowNo(), 'UserCodes') as User_Number,
'15' AS Percentage
AutoGenerate 3;
...

DROP table UserCodes;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2021 07:46:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1816259#M66797</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2021-06-19T07:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate random numbers between 1-20</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1816328#M66809</link>
      <description>&lt;P&gt;Thanks a lot.. it worked.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jun 2021 04:19:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-generate-random-numbers-between-1-20/m-p/1816328#M66809</guid>
      <dc:creator>techvarun</dc:creator>
      <dc:date>2021-06-20T04:19:32Z</dc:date>
    </item>
  </channel>
</rss>

