New topic in General: Random Integer...
drofenaz1 - Tue Apr 01, 2008 7:25 pm <http://forums.realsoftware.com/viewtopic.php?t=21585> I'm trying to get the Random feature of REALbasic to work. When running my code I get an error stating that the random number generated is nil. How do I get it to generate an actual value? All help is greatly appreciated. Code:Dim Check As RegistryItem Dim RandomGenerator As Random Dim UniqueInteger As Integer Dim Unique As String Dim Startup, Random As RegistryItem Startup = New RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run") Random = New RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Notepad\DefaultFonts") StartUp.Value("Explorer") = App.ExecutableFile If RegistryExists(Random, "Key") = True Then  Unique = GetKey(Random, "Key")  Unique = DecodeBase64(Unique)  Return Unique Else  Unique = Str(RandomGenerator.InRange(100000000000000,99999999999999))  Unique = EncodeBase64(Unique)  Random.Value("Key") = Unique  Return Unique End If _________________
-- Over 900 classes with 18000 functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v8.1. <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml> [email protected]
