Random numbers in 2d script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 02:12 PM
I'm trying to write a script for an object that will display random/different people in 2d for elevation drawings. Problem is that the random numbers that ArchiCAD generates are generally the same and not very random!
Is there some way I can force ArchiCAD to generate better random numbers?
I remember writing a programme for my Psion that used random numbers and the best way it did it was getting the time in seconds and multiply that with a "random" number and then get the interger of that result. This was due to the Psion generating somewhat limited random numbers.
Below is the script which calls up a Fragment based on the random number.
10:
Randper= INT (RND (15))
fill bft
pen bpn
fragment2 Randper,1
RETURN
Using AC25 5005 UKI FULL
Mac OSX 10.15.7 (19G2021) Mac Pro-2013 32gbRam AMD FirePro D500 3072 MB graphics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 02:30 PM
You can, as you suggest, come up with your own random number code or you could delete and replace your library part for each random iteration.
The only thing is, people don't arrange themselves randomly, you are probably in for some goofy results. Oh, I get it (I think) it's not random arrangements you are looking for just random characters?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 02:39 PM
Matthew wrote:Yep that's right. The idea is each time you insert the object into the drawing you get a different person displayed.
Oh, I get it (I think) it's not random arrangements you are looking for just random characters?
Basically I'm lazy and hate making decisions

So I think from what you saying that I will need to find away to script the random number so it's more random than what ArchiCAD is coming up with.
Using AC25 5005 UKI FULL
Mac OSX 10.15.7 (19G2021) Mac Pro-2013 32gbRam AMD FirePro D500 3072 MB graphics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 04:34 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 05:38 PM
I have a problem similar to the Subject:
In an object the random calculation seems to be taken twice.
The first for the 3D-Script and the second for the PROJECT2 command in the 2D-Script.
How can this be?
See the pictures below: the colored is a snapshot of the 3D-window,
the non colored is a snapshot of the 2D-window where the object is shown with a PROJECT2-coomand.
(The object shows a brick girder from below; the place of the short bricks is calculated by random)
GDL object creation: b-prisma.de

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 06:20 PM
So in my example it should generate a number greater than 0 but not greater than 12. 12 being the number of fragments I have drawn diffeerent people on. Sadly it just keeps producing the number
I tried using the REQUEST command to find out the time in seconds but have discovered that the REQUEST command produces a text string even although it looks like numbers

Using AC25 5005 UKI FULL
Mac OSX 10.15.7 (19G2021) Mac Pro-2013 32gbRam AMD FirePro D500 3072 MB graphics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 06:23 PM
Joachim wrote:Do you have the RND function in the Master script? If it is in both the 3d and 2d scripts then it should give a different result each time.
Hi,
I have a problem similar to the Subject:
In an object the random calculation seems to be taken twice.
The first for the 3D-Script and the second for the PROJECT2 command in the 2D-Script.
How can this be?
See the pictures below: the colored is a snapshot of the 3D-window,
the non colored is a snapshot of the 2D-window where the object is shown with a PROJECT2-coomand.
(The object shows a brick girder from below; the place of the short bricks is calculated by random)
Least you are getting more "randomness" than me

Using AC25 5005 UKI FULL
Mac OSX 10.15.7 (19G2021) Mac Pro-2013 32gbRam AMD FirePro D500 3072 MB graphics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 07:03 PM
Define style text_style `Arial`, 3, 1, 0
Style text_style
FOR i = 1 TO 12
Text2 0, 0, INT(RND(12))
add2 0, -0.006*GLOB_SCALE
NEXT i
This produced the attached...
A fairly typical random sequence between 0 and 12.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 09:18 PM
What I did find was that when you close and open the drawing again all the numbers change but all the instances of the object still display the same numbers.
So to get the random People in my object to work I would have to insert one instance of the object but have a number of random People appear like your script and I suppose I could also place each Person in a random position similar to Joachim's object. Sounds like this would be an even easier way put some People in my drawing

Using AC25 5005 UKI FULL
Mac OSX 10.15.7 (19G2021) Mac Pro-2013 32gbRam AMD FirePro D500 3072 MB graphics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2004-04-01 09:34 PM
fuzzytnth3 wrote:I think, this is some of GDL engine optimization effect.
Thanks for trying that. I took your script and tried it as an object and what I found was that it does generate random numbers but if you insert the object again it produces exactly the same numbers.
Try this trick to avoid it.
Instead RND(12) type RND(12 + GLOB_INTID*0 )
Oleg