{"title":"System.Randomize([Integer]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-randomize-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-randomize-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-randomize-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Generates a set of random numbers from which the RANDOM method (Integer) will select a random number.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"System.Randomize([Integer]) Method","slug":"systemrandomizeinteger-method","at":0,"chars":1502},{"level":2,"title":"Syntax","slug":"syntax","at":199,"chars":130},{"level":2,"title":"Parameters","slug":"parameters","at":329,"chars":116},{"level":2,"title":"Remarks","slug":"remarks","at":445,"chars":532},{"level":2,"title":"Example","slug":"example","at":977,"chars":391},{"level":2,"title":"Related information","slug":"related-information","at":1368,"chars":134}],"text":"# System.Randomize([Integer]) Method\n> Version: _Available or changed with runtime version 1.0._\nGenerates a set of random numbers from which the RANDOM method (Integer) will select a random number.\n## Syntax\n```al\n System.Randomize([Seed: Integer])\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\n*[Optional] Seed*\nType: ../integer/integer-data-type\nA number used to create a unique set of numbers.\n## Remarks\nIf you use the same number as Seed, the same set of numbers is generated. If you omit this optional parameter, Randomize uses the current system time \\(total number of milliseconds since midnight\\). Calling the Randomize method before the system-random-method makes the random numbers more unpredictable.\nFurthermore, the random generator is specific to each connection so the sequence of numbers that is returned when you call the system-random-method will be the same after each call to Randomize with a specific seed.\n## Example\nThe following example generates random numbers between 1 and 5 by using the Seed from the Randomize method to initialize the random number generator in the system-random-method. The Randomize method uses the data from system clock as the Seed value.\n```al\nvar\n    x: Integer;\n    Text000: Label 'X=%1';\nbegin\n    Randomize();\n    x := Random(5);\n    Message(Text000, x);\nend;\n```\n## Related information\nsystem-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}