<?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: Arcade : Generate Random # Between X and Y in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1009362#M37726</link>
    <description>&lt;P&gt;This works, but how can one get it to work by generating whole numbers? Currently, this is set up to produce floats or doubles.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Dec 2020 17:42:38 GMT</pubDate>
    <dc:creator>adam_gallaher</dc:creator>
    <dc:date>2020-12-14T17:42:38Z</dc:date>
    <item>
      <title>Arcade : Generate Random # Between X and Y</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/154797#M7624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arcade is excellent. I'm digging in and using it alot. But one of the things I am finding a need for is to generate random numbers. I build a lot of demo maps with fake data. I have to generate fake budgets, fake dates, etc. I generally just 'lorem ipsum' for descriptions but I need to be able to better generate more (close to) realistic numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how I could do this with Arcade?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My preference would be Random(x) to get a number between 0 and X. But that isn't to be.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2018 15:20:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/154797#M7624</guid>
      <dc:creator>BrianO_keefe</dc:creator>
      <dc:date>2018-03-08T15:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade : Generate Random # Between X and Y</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/154798#M7625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since Random (&lt;A class="link-titled" href="https://developers.arcgis.com/arcade/function-reference/math_functions/#random" title="https://developers.arcgis.com/arcade/function-reference/math_functions/#random"&gt;Math Functions | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;) returns a value between 0 and 1 you just multiply with the value you want to use as upper boundary:&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;Random&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; X&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a value between&amp;nbsp;A&amp;nbsp;and&amp;nbsp;B, you can do this:&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="token function"&gt;Random&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;B &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; A&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; A&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2018 15:43:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/154798#M7625</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-03-08T15:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade : Generate Random # Between X and Y</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1009362#M37726</link>
      <description>&lt;P&gt;This works, but how can one get it to work by generating whole numbers? Currently, this is set up to produce floats or doubles.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 17:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1009362#M37726</guid>
      <dc:creator>adam_gallaher</dc:creator>
      <dc:date>2020-12-14T17:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade : Generate Random # Between X and Y</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1024370#M38362</link>
      <description>&lt;P&gt;You can use Round() and set it to 0 to return whole numbers i.e. Round(x,0)&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 15:07:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1024370#M38362</guid>
      <dc:creator>Sarah_Saint-Ruth</dc:creator>
      <dc:date>2021-02-08T15:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade : Generate Random # Between X and Y</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1342005#M55314</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/207313"&gt;@Sarah_Saint-Ruth&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create new field with unique ID for hosted layer which already published in AGOL. I can't find any Arcade code for creating unique ID for new field in AGOL . I am thinking about to copy object id to new field but I don't know the arcade code for it.&lt;/P&gt;&lt;P&gt;I will appreciate any help&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 14:59:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1342005#M55314</guid>
      <dc:creator>anonymous55</dc:creator>
      <dc:date>2023-10-26T14:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade : Generate Random # Between X and Y</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1579481#M63328</link>
      <description>&lt;P&gt;1/28/2025 - If anyone comes across this and wants to do this in AGOL Smart Forms below is a method to make more of a string. Sort of like a hexcode value. Due to Arcade and not being pure JavaScript its a bit difficult to develop so going basic and simple like the below helps for numbers, letters, or numbers and letters.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;///FL = Field Location
var prefix = 'FL';
var letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

var num1 = Text(Floor(Random() * 10));
var num2 = Text(Floor(Random() * 10));
var num3 = Text(Floor(Random() * 10));

var letter1 = Mid(letters, Floor(Random() * 26) + 1, 1);
var letter2 = Mid(letters, Floor(Random() * 26) + 1, 1);
var letter3 = Mid(letters, Floor(Random() * 26) + 1, 1);

return prefix + num1 + num2 + num3 + letter1 + letter2 + letter3&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Jan 2025 12:46:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-generate-random-between-x-and-y/m-p/1579481#M63328</guid>
      <dc:creator>DylanKennard-tt</dc:creator>
      <dc:date>2025-01-28T12:46:51Z</dc:date>
    </item>
  </channel>
</rss>

